I want to dump some part of a database, especially some part of a collection using the -q / --query option. Here is what I'm doing:
mongodump --host ... -o ... -q "{ pipe: DBRef(\"pipe\", ObjectId($2)) }"
The dump is operating but is strongly slow. There are 3M objects, and there is an index on the pipe
attribute, so things shouldn't be as slow. It looks like the query is scanning the whole collection.
Any ideas ?
Thanks
You can switch on profiler and see what is happening. Basicly when you specifiy a query you dump will only run this query and convert the answer to the dump. First i thougth it will snapshot the query but no.
With profiler i had the following results :
for this : mongodump -h localhost:27417 -u ... -p ... -d test1 -c t
I had this in the profiler:
For this: mongodump -h localhost:27417 -u ... -p ... -d test1 -c t -q {\'b.b\':8}, i had this:
In the profiler:
That means it utilizes the index what i specified so some other thing probably the bottleneck or the query is not supported by the index you specified.