Skip to content

Commit

Permalink
docs: clarify versionKey is a string (Fix #3747)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 11, 2016
1 parent bdb2248 commit fd0f098
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions docs/guide.jade
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,12 @@ block content

h4#versionKey option: versionKey
:markdown
The `versionKey` is a property set on each document when first created by Mongoose. This keys value contains the internal [revision](http://aaronheckmann.tumblr.com/post/48943525537/mongoose-v3-part-1-versioning) 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:
The `versionKey` is a property set on each document when first created by
Mongoose. This keys value contains the internal
[revision](http://aaronheckmann.tumblr.com/post/48943525537/mongoose-v3-part-1-versioning)
of the document. The `versionKey` option is a string that represents the
path to use for versioning. The default is `__v`. If this conflicts with
your application you can configure as such:
:js
var schema = new Schema({ name: 'string' });
var Thing = mongoose.model('Thing', schema);
Expand All @@ -591,7 +596,9 @@ block content
thing.save(); // { _somethingElse: 0, name: 'mongoose v3' }

:markdown
Document versioning can also be disabled by setting the `versionKey` to false. _DO NOT disable versioning unless you [know what you are doing](http://aaronheckmann.tumblr.com/post/48943525537/mongoose-v3-part-1-versioning)._
Document versioning can also be disabled by setting the `versionKey` to
`false`.
_DO NOT disable versioning unless you [know what you are doing](http://aaronheckmann.tumblr.com/post/48943525537/mongoose-v3-part-1-versioning)._
:js
new Schema({..}, { versionKey: false });
var Thing = mongoose.model('Thing', schema);
Expand Down
2 changes: 1 addition & 1 deletion lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var IS_QUERY_HOOK = {
* - [toObject](/docs/guide.html#toObject) - object - no default
* - [typeKey](/docs/guide.html#typeKey) - string - defaults to 'type'
* - [validateBeforeSave](/docs/guide.html#validateBeforeSave) - bool - defaults to `true`
* - [versionKey](/docs/guide.html#versionKey): bool - defaults to "__v"
* - [versionKey](/docs/guide.html#versionKey): string - defaults to "__v"
*
* ####Note:
*
Expand Down

0 comments on commit fd0f098

Please sign in to comment.