Question: I'm new to mongodb , and i try to insert data in database through my html page using post method. and i use mongoose in server side.
here is my code look like.

```
 var LoginInfoSchema = new mongoose.Schema
 ({
     _id : String,
     user: String,
     password: String
 });

 var user = mongoose.model('user',LoginInfoSchema);

 app.post('/login', function(req, res) {
    new user({
          _id : req.body.email,
          user : req.body.user,
          password : req.body.password
            }).save(function(err,doc){
        if(err) res.json(err);
        else res.redirect('/');
    });
    mongoose.connect('mongodb://localhost:27017/UserInfo',function(err,db){
        if(err) console.log(err);
        db.collection("users").insertOne(user, function(error, result) {
        if(error) console.log(error);
        console.log("1 document inserted");
      db.close();
    });

  });
  });

```

whenever i insert data from localhost html page it will inserted successfully , i see that from mongo.exe terminal but i got error that is 

name: 'MongoError',
 message: 'Write batch sizes must be between 1 and 100000. Got 0 operations.',
 ok: 0,
 errmsg: 'Write batch sizes must be between 1 and 100000. Got 0 operations.',
 code: 16,
 codeName: 'InvalidLength',
 [Symbol(mongoErrorContextSymbol)]: {} }

i search everywhere i cannot solve it . what its exactly mean please answer.

Answer: 
The MongoDB error "Write batch sizes must be between 1 and 100000. Got 0 operations." results from trying to apply a write operation to no arguments, e.g. update an array of zero documents:

```
db.runCommand(
   {
      update: 'some-collection',
      updates: [],   // Uh-oh, no documents!
      comment: 'this is gonna fail',
   }
)

```

The OP's code results in this error because the call to `insertOne` is passed the Mongoose constructor `user` rather than a document created with `new user(...)`.
I too also got stuck in the same error for quite a long. The above answers are perfect to solve the error but I would also suggest you to check the sequence of the parameters(object & callback function) you have sent to the MongoDB connect function.
MongoClient.connect(function(parameters))

From controllers to the models when we send

Thanks