Closed weikunlu closed 8 years ago
I have tried several Bson apis but fail... It looks like I can't use JS function in java.
also find similar discuss here. https://groups.google.com/forum/#!searchin/mongodb-user/date$20java%7Csort:relevance/mongodb-user/1ldJdhPY3M8/Vg-qZ9F1h_4J
Tip: Use $currentDate mongo operator
I'm closing this right now, feel free to re-open if you have additional questions.
I convert my timestamp field to date object through below method.
{ "_$project": {"value":"1", "time":{ "_$dateToString": { "format": "%Y-%m-%d %H%M%S", "date": {"_$add": [new Date(0), "$timestamp"]}}}}},
but restheart send me "message": "Invalid JSON"
is there any way to define script code for this case? just like passing variables to aggregation operations { "$var" : "n" }, we could also define a {"$javascript":"new Date(0)"}