I am reading date from one .txt file and need to compared inside the mongoexport query

start_dt=sort -n /path/date.txt | tail -1
I am converting this date to ISODate beacause it’s is in ISODate formate in mongodb

mongoexport --ssl --sslCAFile $sslCAFile --host $host -u $username -p $password --collection $collectionMember --db $database --limit 5 \

 --query '{

 "memberCard.cardMbrDtlsUpdatedTms": {

  "$gte": $x

}}’ \

–out $output

I am getting the output with 0 records when we pass the dates manually It’s fetching 5 records based on limt.

Hello @Yugandhar_Prathi ,

I notice you haven’t had a response to this topic yet - were you able to find a solution?
If not, then you can try below.

ISODate() is a javascript function, hence will not work here.

According to the mongoexport doc

The query must be in Extended JSON v2 format (either relaxed or canonical/strict mode), including enclosing the field names and operators in quotes:

So you can try using the date like

{"$gte": {"$date": "2015-01-01T00:00:00.000+0000"}}

Let me know if you have any more questions.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.