MCPcopy Create free account
hub / github.com/Automattic/mongoose / DivergentArrayError

Function DivergentArrayError

lib/error/divergentArray.js:14–32  ·  view source on GitHub ↗
(paths)

Source from the content-addressed store, hash-verified

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 this.name = 'DivergentArrayError';
27 if (Error.captureStackTrace) {
28 Error.captureStackTrace(this);
29 } else {
30 this.stack = new Error().stack;
31 }
32}
33
34/*!
35 * Inherits from MongooseError.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected