adds __v property to document

This commit is contained in:
Simon
2016-08-26 16:49:28 -04:00
parent 28b47d424e
commit 51c51f0354
2 changed files with 7 additions and 0 deletions

View File

@@ -1081,6 +1081,7 @@ var MongoModel = mongoose.model('MongoModel', new mongoose.Schema({
}), 'myCollection', true);
MongoModel.find({}).$where('indexOf("val") !== -1').exec(function (err, docs) {
docs[0].save();
docs[0].__v;
});
MongoModel.findById(999, function (err, doc) {
doc.increment();

View File

@@ -2332,6 +2332,12 @@ declare module "mongoose" {
* @param fn optional callback
*/
save(fn?: (err: any, product: this, numAffected: number) => void): Promise<this>;
/**
* Version using default version key. See http://mongoosejs.com/docs/guide.html#versionKey
* If you're using another key, you will have to access it using []: doc[_myVersionKey]
*/
__v?: number;
}
interface ModelProperties {