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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -