MongoDB and Nodejs insert ID with auto increment
<p>I am new to NodeJs and MongoDB, i want to insert row with auto increment primary key 'id'. also defined a function called getNextSequence on mongo server. </p>

<p>this is working perfect on Mongodb server</p>

<pre><code> &gt; db.user.insert({   
     "id" : getNextSequence('user_id'), 
     "username" : "test", 
     "email" : "test@test.com", 
     "password" : "test123" 
 })
</code></pre>

<p>now i want to insert from NodeJs.I have tried this but not working </p>

<pre><code>db.collection('user').insertOne({
    id : "getNextSequence('user_id')",  
    username : query.name, 
    email: query.email, 
    password: query.pass
}, function(err, result) {
    assert.equal(err, null);
    console.log("row insterted ");
    callback();
});
</code></pre>