Skip to content

Commit

Permalink
docs; clarify error returned by unique indexes
Browse files Browse the repository at this point in the history
relates to #1225
  • Loading branch information
aheckmann committed Dec 6, 2012
1 parent f25c7c2 commit 8456daf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/schematype.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ SchemaType.prototype.index = function (options) {
/**
* Declares an unique index.
*
* ####Examples:
* ####Example:
*
* var s = new Schema({ name: { type: String, unique: true })
* Schema.path('name').index({ unique: true });
*
* _NOTE: violating the constraint returns an `E11000` error from MongoDB when saving, not a Mongoose validation error._
*
* @param {Boolean} bool
* @return {SchemaType} this
* @api public
Expand All @@ -145,7 +147,7 @@ SchemaType.prototype.unique = function (bool) {
/**
* Declares a sparse index.
*
* ####Examples:
* ####Example:
*
* var s = new Schema({ name: { type: String, sparse: true })
* Schema.path('name').index({ sparse: true });
Expand Down

0 comments on commit 8456daf

Please sign in to comment.