Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodump will not honor query on collection

I'm running the following command on a box that is part of a sharded replicate set. I'm just trying to export from this specific shard, I will run the same command on the other shard as well.

When I do this, Mongo should be dumping a maximum of 1.72 million records, but instead, it looks like it's trying to export the total 590 million records in the collection. Why won't the query apply and export just my selection of data?

mongodump -d obscured -c message --query "{sendDate: {\$gt: 1380499200}}" \ 
          --out=da1-messagedump --port=27018

any help would be greatly appreciated.

like image 499
Cody Halovich Avatar asked Sep 16 '13 20:09

Cody Halovich


1 Answers

Have you look at the documentation?

MongoDB docs

As I don't know which steps you are performing, it's complicated to guess. But apparently you need to freeze each member of the shard before exporting.

like image 84
Graciano Avatar answered Oct 14 '22 05:10

Graciano