title: How to assign an id value in mongodb?
body: <p>I'm working with node.js and mongoose. I'm creating a REST API to expose my User model:</p>
  
  <pre><code>var userSchema = new Schema({
   _id: {type:Number},
   username: {type:String},
   age: {type:Number},
   genre:{type: Number,ref:'Genre'},
   country: {type: Number,ref:'Country'}
  });
  </code></pre>
  
  <p>As you can see I decided to include an _id field, so if I want to create a new user I'll need to generate the value for this field, for example:</p>
  
  <pre><code>exports.createUser = function(req,res){
   var user = new User({
      _id: //Generate and assing value here
          //Other properties are retrieved from the request object
   });
  };
  </code></pre>
  
  <p>How could I "generate" or assign a value to my _id field properly? How does mongo deals with this? </p>