$set is not working on mongodb update
<p>So im working with <code>nodeJS</code> and <code>mongoDB</code>. im having a problem with updating a collection and its been a week since im working on it and it really gives me a headache. so this is my Sample collection</p>

<pre><code>{
  "_id": ObjectId('51299sdfasdf') //this is just a sample Id     
  "names": [
      "NameA",
      "NameB",
      "NameC"   
   ],
  "names_id": [
     ObjectId('asdfasdf1312'),
     ObjectId('12sda123123a'),
     ObjectId('asdf1212123a')
  ],
  "user_alias": "SampleA"
}
</code></pre>

<p>then here's my script</p>

<pre><code>var mongoose = require('mongoose');
var model = mongoose.model('Sample');

model.update( { _id: req.query._id }, 
       {
          $set: {
             names: namesArray, //this are set of names ex; ['name1', 'name2']
             names_id: namesIdArray //this are set of ids ex: [ ObjectId('sgsdfgsd'), ObjectId('asdfasdfadf')
          },
       },
       function(err, results) {
           if(err) res.status(500).send(err);
               console.log(results);


           }  
       );
</code></pre>

<p>I know I code it right. in the names_id arrays i specify all the object Ids like this <code>mongoose.mongo.ObjectId('id here')</code>. but it doesn't updating anything. here's the result.</p>

<pre><code>{ ok: 1, nModified: 0, n: 1 }
</code></pre>

<p>What's the issue here? is this because of the version? my <code>mongoose</code> version is <code>2.15.8</code></p>

<p>Please help me out! thank you!</p>