Hi Nitesh,
Everything Asya said is correct.
Regarding your error message, the constructor for ISODate expects a valid ISO8601-format date. For example, the below will work:
> var x = new ISODate("2014-05-05")
> x
ISODate("2014-05-05T00:00:00Z")
Essentially, you have two approaches to storing date-only fields:
- Use MongoDB ISODate, and have your application code handle ignoring anything past the day field. You will also need to ensure all of your dates are converted to a uniform timezone (e.g. UTC) prior to importing.
- Use a string field and store a well-ordered date - e.g. YYYYMMDD.
Further, in Excel, you can control how dates are displayed. Select your cells, then hit Ctrl + 1 (Windows) or Command + 1 (OSX). Then in the Format Cells dialog, select the appropriate date format.
If you can provide more details on the exact steps you are taking to import this data from Excel to MongoDB, we can help you better.
Please let me know if you have any queries about any of the above.
Regards,
Victor