Now that mongorestore no longer has the —filter option in versions 3 and
above, how does one filter data being restored?
The reason --filter is not available in mongorestore 3.0.x and above is
because the tools (e.g. mongodump, mongorestore, mongoexport, etc.) were
separated from the main server C++ code (e.g. mongod and mongos) and
rewritten in Go. Query parsing is part of the server codebase, and is not
available as a generic library. For more background on the 3.0 tools
rewrite please see Putting the Go in MongoDB: How We Rebuilt The MongoDB
Tools in Go
Pre-3.0.x, the tools share actual mongod server code — that is why options
like --filter or --dbpath could exist in mongorestore. With MongoDB 3.0 the
tools were rewritten to support the new Storage Engine API and include
features like improved concurrency.
The way forward for us may be to use mongodump with —query. The downside is
that instead of one dump of everything from which I can import with
filters, I’ll have to make numerous—scores of — dumps with —query and then
mongorestore from each of those.
For MongoDB version 3.0.x and above, using mongodump --query is the
recommended method if you need partial dump of your data.
One thought: is it possible to use 2.6 tools with 3.0 dbs? (Though the
performance hit would be painful.)
This is not recommended due to major differences between versions 2.6.x and
3.0.x (e.g. auth schema, WiredTiger, etc). There are also bugs in older
versions (e.g. the aforementioned TOOLS-1039
<https://jira.mongodb.org/browse/TOOLS-1039>) that were fixed in later
versions and could compromise your backup.
You received this message because you are subscribed to the Google Groups "mongodb-user"