I have a problem with date and datetime inside runCommand of MongoDB. It has been saving my date in null. I could not use ISODate() because it give a error. The variable $date hasn't show me a error but it storged a null value.
This is the mongoDB's query string that I'm executing from Java application:
{
q: {
'person_id': '1003', 'authoriz.auth_id': { $ne: '1025' } },
u: {
$addToSet: {
'authoriz': {
'decision': "TRUE",
'start_date': { $date: "2018-02-09 00:00:00.0" },
'decision_id': 125,
'decision_dsc': "PERMITED",
'block_id': "1025"
}
},
$currentDate: {
'last_modified': true
}
},
multi: false,
upsert: false
}
In Java:
DBObject dbObject = (BasicDBObject) JSON.parse(query);
CommandResult result =anyDB.command(dbObject);
Instead of save '2018-02-09 00:00:00.0' value in field start_date it has been storaging a null value.
Could you help me how I set up my query string to save the date? Are there any others option How I use date with runCommand?