mongodb - Export data to csv file using $in -
i trying export data csv file using mongo export condition following command
mongoexport --db <db_name> --collection <coll_name> --query "'meta.metadata.fieldname' : {$in : [ezr-2016-21123,ezr-2016-22016, ezr-2016-23420]}}" --fields <field_name> --type=csv --out out_file_name.csv
this works fine other normal query, when put $in, doesn't work.
you need updated query following
mongoexport --db <db_name> --collection <coll_name> --query "{'meta.metadata.fieldname' : {'$in' : ['ezr-2016-21123', 'ezr-2016-22016', 'ezr-2016-23420']}}" --fields <field_name> --type=csv --out out_file_name.csv
- you missing starting
{
off query - strings within
$in
array need quoted
Comments
Post a Comment