thoughts/node_modules/mongoose/lib/errors/divergentArray.js
node_modules/mongoose/lib/errors/divergentArray.jsRaw
1
2/*!
3 * Module dependencies.
4 */
5
6var MongooseError = require('../error');
7
8/*!
9 * DivergentArrayError constructor.
10 *
11 * @inherits MongooseError
12 */
13
14function DivergentArrayError (paths) {
15 var msg = 'For your own good, using `document.save()` to update an array '
16 + 'which was selected using an $elemMatch projection OR '
17 + 'populated using skip, limit, query conditions, or exclusion of '
18 + 'the _id field when the operation results in a $pop or $set of '
19 + 'the entire array is not supported. The following '
20 + 'path(s) would have been modified unsafely:\n'
21 + ' ' + paths.join('\n ') + '\n'
22 + 'Use Model.update() to update these arrays instead.'
23 // TODO write up a docs page (FAQ) and link to it
24
25 MongooseError.call(this, msg);
26 Error.captureStackTrace(this, arguments.callee);
27 this.name = 'DivergentArrayError';
28};
29
30/*!
31 * Inherits from MongooseError.
32 */
33
34DivergentArrayError.prototype.__proto__ = MongooseError.prototype;
35
36/*!
37 * exports
38 */
39
40module.exports = DivergentArrayError;