什么是“__v"?猫鼬的领域 [英] What is the "__v" field in Mongoose
本文介绍了什么是“__v"?猫鼬的领域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 Mongoose
版本 3 和 MongoDB
版本 2.2.我注意到 __v
字段开始出现在我的 MongoDB
文档中.它与版本控制有关吗?怎么用?
I'm using Mongoose
version 3 with MongoDB
version 2.2. I've noticed a __v
field has started appearing in my MongoDB
documents. Is it something to do with versioning? How is it used?
推荐答案
来自这里:
versionKey
是每个文档第一次创建时设置的属性猫鼬.此键值包含内部修订文档.此文档属性的名称是可配置的.这默认为 __v
.
The
versionKey
is a property set on each document when first created by Mongoose. This keys value contains the internal revision of the document. The name of this document property is configurable. The default is__v
.
如果这与您的应用程序冲突,您可以这样配置:
If this conflicts with your application you can configure as such:
new Schema({..}, { versionKey: '_somethingElse' })
这篇关于什么是“__v"?猫鼬的领域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文