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.

40 lines
1.1 KiB

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