Mongodump export condition error

  mongodb, question

mongodump or mongoexport use –query,but have not filteredthe result, it exportsall data.
my condition is like this:

{“modifiedOn” : ISODate(“2018-06-06T00:00:12.539+0000”)}

and i change itisto 1528244529
but when i use this:

mongodump -h 192.168.169.63:27017 -d product_operation_sold -c ebay_payment --query '{"modifiedOn":{$gt: Date(1528244529)}}' -o /root

whatwasam I doingmywrong?

Try using$dateinstead ofDate/ISODatewhen using with bash tools:

mongodump -h 192.168.169.63:27017 -d product_operation_sold -c ebay_payment --query '{"modifiedOn":{$gt: {$date: "2018-06-06T00:00:12.539Z"}}}' -o /root

This also applies to following tools:

  • mongodump
  • mongorestore
  • mongoimport
  • mongoexport