title: MongoDB “empty” or NULL Date
body: <p>I will begin using MongoDB in a project and made the following observation:
   <strong>‘Date’ must be a valid point in time, and cannot be NULL</strong>.</p>
  
  <p>With MongoDB, we <strong>cannot store a NULL date</strong>, so I am guessing that the best thing to do is to simply <strong>exclude the date field</strong> from our document.  </p>
  
  <p>For example, if I have a ‘car’ document and a field named ‘<strong>date_sold</strong>’.  If the car has not been sold yet, I simply <strong>exclude this field</strong> from the document.  Once the car sells, I can <strong>add the 'date_sold' field</strong>.</p>
  
  <p>By doing the above, I am assuming that I can query records for cars sold or not sold.  Is this a recommended way to handle “empty” or null dates in MongoDB?</p>
  
  <p>P.S.  My confusion stems from the fact that since SQL has a schema, date or datetime fields can be stored as NULL, but in MongoDB, a ‘Date’ field cannot be NULL and must be a valid point in time.</p>