Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

divergentArray.js 1.2KB

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