Search code examples
mongodbmongodump

Use MongoDump to return on specific columns


I know how to use MongoDump to dump the result of a specific query using the following command:

mongodump --username USER --password PASSWORD --db DBNAME --collection COLLECTION-NAME --query 
"{\"SOME-COLUMN\" : { \"$binary\" : \"SOME-BIN-DATA==\", \"$type\" : \"03\" } }"

But this will return back the entire document(s). is it possible to use MongoDump to return on a subset of the document? I want MongoDump to return only the ids of all collections matching the query, is it possible?

Thanks!


Solution

  • Projection in mongodump is not yet available. Reference.

    mongoexport has such functionality using fields.