From 8456daf9f982e0cb0d051ef233cd06b2dfa3b67e Mon Sep 17 00:00:00 2001 From: Aaron Heckmann Date: Thu, 6 Dec 2012 09:59:33 -0800 Subject: [PATCH] docs; clarify error returned by unique indexes relates to #1225 --- lib/schematype.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/schematype.js b/lib/schematype.js index 037cbacfeb..c127cd14e0 100644 --- a/lib/schematype.js +++ b/lib/schematype.js @@ -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 @@ -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 });