Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 263
sternr Avatar asked Nov 28 '25 07:11

sternr


1 Answers

Projection in mongodump is not yet available. Reference.

mongoexport has such functionality using fields.

like image 183
undefined_variable Avatar answered Nov 29 '25 22:11

undefined_variable



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!