The export fails, in a previously published post it was said that it worked
It doesn’t work for me
mongoexport --db TEST–username user01–authenticationDatabase admin --collection history
–query=‘{“createAt”: {“$lt”: {“$date”: “2020-10-07TT00:00:00.000Z”}}}’
–type json
–out=/data/db/dump/full_col_activities_hoy.json
What’s the error you’re getting when you run the command?
It seems there are a few issues with the command you’re using, possibly due to how it was formatted in the forums. Here’s a corrected version that works for me:
mongoexport --db TEST --username user01 --authenticationDatabase=admin --collection history
--query='{"createAt": {"$lt": {"$date": "2020-10-07TT00:00:00.000Z"}}}'
--type=json
--out=/data/db/dump/full_col_activities_hoy.json
Note that the field createAt might be a typo of createdAt.
Hello Stanimira_Vlaeva,
I had to use the --queryFile clause and create a json file with the instruction gte date1 and lt date2, that’s how it worked for me.