@@ -232,6 +232,14 @@ SchemaString.prototype.enum = function() {
232
232
* console.log(m.email) // [email protected]
233
233
* M.find({ email: 'SomeEmail@example .com' }); // Queries by '[email protected] '
234
234
*
235
+ * Note that `lowercase` does **not** affect regular expression queries:
236
+ *
237
+ * ####Example:
238
+ * // Still queries for documents whose `email` matches the regular
239
+ * // expression /SomeEmail/. Mongoose does **not** convert the RegExp
240
+ * // to lowercase.
241
+ * M.find({ email: /SomeEmail/ });
242
+ *
235
243
* @api public
236
244
* @return {SchemaType } this
237
245
*/
@@ -262,6 +270,12 @@ SchemaString.prototype.lowercase = function(shouldApply) {
262
270
* console.log(m.caps) // AN EXAMPLE
263
271
* M.find({ caps: 'an example' }) // Matches documents where caps = 'AN EXAMPLE'
264
272
*
273
+ * Note that `uppercase` does **not** affect regular expression queries:
274
+ *
275
+ * ####Example:
276
+ * // Mongoose does **not** convert the RegExp to uppercase.
277
+ * M.find({ email: /an example/ });
278
+ *
265
279
* @api public
266
280
* @return {SchemaType } this
267
281
*/
@@ -288,12 +302,21 @@ SchemaString.prototype.uppercase = function(shouldApply) {
288
302
*
289
303
* ####Example:
290
304
*
291
- * var s = new Schema({ name: { type: String, trim: true }})
292
- * var M = db.model('M', s)
293
- * var string = ' some name '
294
- * console.log(string.length) // 11
295
- * var m = new M({ name: string })
296
- * console.log(m.name.length) // 9
305
+ * var s = new Schema({ name: { type: String, trim: true }});
306
+ * var M = db.model('M', s);
307
+ * var string = ' some name ';
308
+ * console.log(string.length); // 11
309
+ * var m = new M({ name: string });
310
+ * console.log(m.name.length); // 9
311
+ *
312
+ * // Equivalent to `findOne({ name: string.trim() })`
313
+ * M.findOne({ name: string });
314
+ *
315
+ * Note that `trim` does **not** affect regular expression queries:
316
+ *
317
+ * ####Example:
318
+ * // Mongoose does **not** trim whitespace from the RegExp.
319
+ * M.find({ name: / some name / });
297
320
*
298
321
* @api public
299
322
* @return {SchemaType } this
0 commit comments