I'm trying to run mongoexport on my server but it yields 0 records.
Here is my script
mongoexport --db=customer --collection=transaction --type=csv --query='{"program": "online", "create_time": {"$gte": "2023-01-01 00:00", "$lt": "2023-01-02 00:00}, "amount" : {"gt": 0}}' --out=out.csv --fields=field1,field2,field3 --uri="mongodb://username:password@localhost1,localhost2/?authsSource=admin
Here is the output
2023-01-13T11:28:17.715+0700 connected to mongodb://username:password@localhost1,localhost2/?authsSource=admin
2023-01-13T11:28:17.715+0700 customer.transaction 0
2023-01-13T11:28:17.715+0700 customer.transaction 0
2023-01-13T11:28:17.715+0700 customer.transaction 0
And the result of the out.csv file is blank.
What did I miss here?
Nevermind.. Apparently the zeros in the terminal output indicates the rows is being read. Hence my script is correct.
Here's the output if anyone curious.
And the output file
out.csvis filled.