how to update a variable field in a document using mongoose
<p>I am using</p>

<pre><code>db.hs.update( 
     {username: "hraj3116", "event_movie.name": "h"},
     {$set:{"event_movie.$.theatre":"vikas mall"}
     })
</code></pre>

<p>this to update in mongodb and this is working fine. How Can I use this using mongoose. I want "event_movie" as variable.</p>

<p>I am using </p>

<pre><code>var  s = {'event_movie.name' : 'h'};
var event = {"event_movie.$.theatre" : "theatre"}; 
//event["event_movie.$.theatre"] = "theatre";
UserEventsDetails.findOneAndUpdate(
{ "username": username , s },
{ "$set": event },
{ "upsert": true, "new": true},
function(err, model){
    if (err){
        res.send(500, err);
    }else{
          res.send('done');
    }
});
</code></pre>