PageRenderTime 26ms CodeModel.GetById 19ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/mongoose/lib/error/divergentArray.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 46 lines | 21 code | 10 blank | 15 comment | 2 complexity | c70e4f9e749f4af386ca591b5c5bc777 MD5 | raw file
 1
 2/*!
 3 * Module dependencies.
 4 */
 5
 6var MongooseError = require('./');
 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  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.
36 */
37
38DivergentArrayError.prototype = Object.create(MongooseError.prototype);
39DivergentArrayError.prototype.constructor = MongooseError;
40
41
42/*!
43 * exports
44 */
45
46module.exports = DivergentArrayError;