when i see the this answer// convert this type of string date And I followed it this way.
20170721123840+0900
var a = new Date({$concat: [ "2017"," ",
"11"," ",
"11"," ",
"11",":",
"11",":",
"11"," ",
"+0900" ] } )
a
This is what I expected.
var b = new Date("2017 07 21 12:38:40 +0900")
b
ISODate("2017-07-21T03:38:40Z")
But this was the result.
ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
Why is this form coming out? What do you do to solve it?
$concatcan actually be used ( since it is an aggregation pipeline operator ). In the context you are trying you simply use regular JavaScript expressions to "concatenate" the strings. If your actual intent to is convert existing document data from "string" to BSON Date, then instead you must "loop" the results and update, as is also pointed out on the answers to the same question you reference.