Skip to content
Browse files

changed; the virtual id can now be skipped

  • Loading branch information...
1 parent 1e5a5b4 commit 825680f0b3ef69fc3b8ec2825caedad4c4a93d0a @aheckmann aheckmann committed
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/mongoose/schema.js
View
10 lib/mongoose/schema.js
@@ -40,9 +40,13 @@ function Schema (obj, options) {
if (!this.paths['_id'])
this.add({ _id: {type: ObjectId, auto: true} });
- if (!this.paths['id']) this.virtual('id').get(function () {
- return this._id.toString();
- });
+ if (!this.paths['id'] && !this.options.novirtualid) {
+ this.virtual('id').get(function () {
+ return this._id.toString();
+ });
+ }
+
+ delete this.options.novirtualid;
};
/**

0 comments on commit 825680f

Please sign in to comment.
Something went wrong with that request. Please try again.