showing results for - "model mongoose"
Jak
27 Jul 2018
1const Tank = mongoose.model('Tank', yourSchema);
2
3const small = new Tank({ size: 'small' });
4small.save(function (err) {
5  if (err) return handleError(err);
6  // saved!
7});
8
9// or
10
11Tank.create({ size: 'small' }, function (err, small) {
12  if (err) return handleError(err);
13  // saved!
14});
15
16// or, for inserting large batches of documents
17Tank.insertMany([{ size: 'small' }], function(err) {
18
19});