I want to export collection in mongodb using shell command:
I try the following command but fields with “:” (number:phone, number:fax) are not exported.
mongoexport --csv -d schemaName -c collectionName -q "{typeName:'user'}" -f "name, surname, e-mail, number:phone, number:fax" -o export.csv
I think that you have found a legitimate bug. The
mongoexporttool is rarely used and the colon means something very specific when parsing JSON, so the tool is probably confused.You can file the bug here: http://jira.mongodb.org/