@types/mongoose: following @simonxca advice and adding more tests

This commit is contained in:
Fábio Batista
2017-04-07 21:29:22 -03:00
parent 55051ca1b7
commit c6ff176b82
+6 -5
View File
@@ -1213,12 +1213,13 @@ MongoModel.find({}).$where('indexOf("val") !== -1').exec(function (err, docs) {
docs[0].__v;
});
MongoModel.findById(999, function (err, doc) {
var handleSave = function(err: Error, product: mongoose.Document, numAffected: number) {};
doc.increment();
doc.save(cb).then(cb).catch(cb);
doc.save({ validateBeforeSave: false }, cb).then(cb).catch(cb);
doc.save({ safe: true }, cb).then(cb).catch(cb);
doc.save({ safe: { w: 2, j: true } }, cb).then(cb).catch(cb);
doc.save({ safe: { w: 'majority', wtimeout: 10000 } }, cb).then(cb).catch(cb);
doc.save(handleSave).then(cb).catch(cb);
doc.save({ validateBeforeSave: false }, handleSave).then(cb).catch(cb);
doc.save({ safe: true }, handleSave).then(cb).catch(cb);
doc.save({ safe: { w: 2, j: true } }, handleSave).then(cb).catch(cb);
doc.save({ safe: { w: 'majority', wtimeout: 10000 } }, handleSave).then(cb).catch(cb);
});
MongoModel = (new MongoModel()).model('MongoModel');
var mongoModel = new MongoModel();