title: MongoDB: I want to store array object in collection
body: <p>I get array object from front side, and want to save it in collection using NodeJS, Mongodb.</p>
  
  <p>My object is:</p>
  
  <pre><code>routerData={"User-Name":
      {"type":"string","value":["\u0000\u0000\u0000\u0000"]},
  "NAS-IP-Address":
      {"type":"ipaddr","value":["10.1.0.1"]}
  },
  </code></pre>
  
  <p>My collection schema is:</p>
  
  <pre><code>var model = new Schema({
  routerData:{
      "User-Name": {
          "type": String,
          "value": []
      },
      "NAS-IP-Address": {
          "type": String,
          "value": []
      },
  
  },
  });
  </code></pre>
  
  <p>I am trying with this code:</p>
  
  <pre><code>var obj = new objModel(req.body);
  obj.routerData = req.body.routerData;
  obj.save(function (err, result) {
  
  });
  </code></pre>
  
  <p>i am getting this error:</p>
  
  <pre><code>"message": "Cast to Object failed for value \"{\"User-Name\":{\"type\":\"string\",\
  </code></pre>