title: Error when setting field as null in Mongoose
body: <p>I am using MongooseJS. I am getting the error below:</p>
  
  <pre><code>{ message: 'Cast to ObjectId failed for value "" at path "parent"',
    name: 'CastError',
    type: 'ObjectId',
    value: '',
    path: 'parent'
  }
  </code></pre>
  
  <p>I don't want to set a parent for this object. Where am I wrong? What should I do?</p>
  
  <p>Update:</p>
  
  <pre><code>var category = new Category(req.body)
  if(typeof category.parent === 'undefined'){
      category.parent=undefined;
  }
  </code></pre>
  
  <p>And the category schema is:</p>
  
  <pre><code>var CategorySchema = new Schema({
    name: {
      tr: {type : String, default : '', trim : true},
      en: {type : String, default : '', trim : true}
    },
    description: {
      tr: {type : String, default : '', trim : true},
      en: {type : String, default : '', trim : true}
    },
    subcategories:[{type : Schema.ObjectId, ref : 'Category', null: true}],
    parent: {type : Schema.ObjectId, ref : 'Category', null: true},
    products:[{type : Schema.ObjectId, ref : 'Product'}],
    images : [String],
    order: {type : Number, default: 0},
    createdAt  : {type : Date, default : Date.now},
    locale: {type : String, null: false}
  })
  </code></pre>
  
  <p>My jade code is:</p>
  
  <pre><code>.controls
          select#parent(name="parent")
            option(value="") Select
            each cat in categories
              - if (category.subcategories.map(function(e) { return e.id; }).indexOf(cat.id) != -1)
                  option(value=cat.id, selected) #{cat.name.tr}
              - else
                  option(value=cat.id) #{cat.name.tr}
  </code></pre>
  
  <p>So if user do not select a parent, it sends "" to server and server gives that error.</p>