With a mongo datasource how do I filter by timestamp?
The syntax:
"_id key" : {"$toDate": "$_id"},
converts the $_id field (likely a string value) into a timestampfor example:
"date_created" : {"$dateToString" : {"date" : {"$toDate" : "$_id"}, "format" : "%Y-%m-%d %H:%m:%S"}}
Another example:
db[‘sendingActivity’].aggregate([ {
“$project” : {
“_id key” : {“$toDate”: “$_id”},
“_id” : 0
}
}, {
“$limit” : 10000
} ])
Please sign in to leave a comment.
0 comments