hello team,
I am leveraging toDate in aggregation function and seems like i am running into issues during conversion
here is a sample data field 2021-09-16T18:31:12.553723274Z
and i have this as finish_time which gets populated by system and start_time as `2021-09-10T21:19:13Zand based on my understanding i believe this format
"%Y-%m-%dT%H:%M:%S.%LZ"` only works if %L is only 3 digits or less and based on my time format its more than 3 digits and its failing due to that. Is there a way to convert this considering this is standard format and leverage any inbuilt functions for this?
btw i have mongodb 4.2.6 and wondering if there is a way to define custom format or increase the digit count for %L in the default format to fit these conversions?
Error:
Uncaught exception: Error: command failed: {
"operationTime":Timestamp(1633635802,
1),
"ok":0,
"errmsg":"Error parsing date string '2021-10-01T08:17:48.849825775Z'; 0: passing a time zone identifier as part of the string is not allowed '2'",
"code":241,
"codeName":"ConversionFailure",
"$clusterTime":{
"clusterTime":Timestamp(1633635802,1),
"signature":{
"hash":BinData(0,
"ecRctainVJJjFYxL5t3bO9NWQ8o="")",
"keyId":"NumberLong(""6967261630782504961"")"
}
}
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:18:14
_assertCommandWorked@src/mongo/shell/assert.js:583:17
assert.commandWorked@src/mongo/shell/assert.js:673:16
DB.prototype._runAggregate@src/mongo/shell/db.js:266:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1012:12
DBCollection.prototype.aggregate@:1:355
@(shell):1:1