Search code examples
mongodbmongoimportmongodb-compass

Mongo db : data uploaded using CSV has Null stored as String in Mongo document


I tried uploading data into Mongodb using CSV from Mongodb Compass. In the CSV, some of the fields have Null values stored in them. But, after uploading those fields in Mongo, documents have "Null" stored as String. Is there a way to store Null fields from CSV with the type Null?


Solution

  • I couldn't find a solution to import the data with NULL values using CSV and have them stored with datatype NULL in Mongodb. Then I imported the same data using JSON and it worked!! Importing data using JSON makes it to interpret NULL as NULL datatype, not as string.