MongoDB + Compass exporting strings and numbers "columns" with value of 1 as "true"(boolean) and 2 or null as "false" to CSV When I export my MongoDB collection to a CSV, the String and Number &quot;column&quot; data types values are converted to &quot;true&quot; for 1 and &quot;false&quot; for 2 and null - how do I retain the values as numbers, strings and integers on export to CSV from Compass?
While I have not been able to completely eliminate the possibility of MongoDB Compass exporting 1's and &quot;true&quot; (bool) or 0's and &quot;false&quot; (bool) nor remove NaN in some &quot;columns&quot; with NULLs mixed with numbers, using &quot;Int32&quot; and &quot;Int64&quot; data types for non-decimal values reduces the number of &quot;false bools&quot;, significantly in my MongoDB Compass exports (but not completely - enough to greatly reduce the number of manual/script changes).
The best workaround I have for these quirks of Compass is to switch to Robo 3T (Formerly known as Robomongo) which seems much more consistent and less &quot;auto-magic&quot; happening in the background. It's just a better tool for MongoDB all-around, IMPO.
Link: https://robomongo.org/download
Note: Download just the 'Robo 3T: &quot;The Hobbyist GUI&quot;' and not the Studio 3T package unless you want to spend money for it in a few weeks.

This is just one example of the MANY inconsistent behaviors I've observed while using Compass in Linux with a Gnome GUI instead of the mongoshell or Robo 3T on the same machine.
You can just use the mongoshell commands inside of Robo 3T to perform your CSV exports:
Example: mongoexport --db=PetHotel --collection=pets --type=csv -- fields=_id,name,type,weight --out=data/pets.csv