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.

26 lines
779 B

  1. /**
  2. * ES6 Promise wrapper constructor.
  3. *
  4. * Promises are returned from executed queries. Example:
  5. *
  6. * var query = Candy.find({ bar: true });
  7. * var promise = query.exec();
  8. *
  9. * DEPRECATED. Mongoose 5.0 will use native promises by default (or bluebird,
  10. * if native promises are not present) but still
  11. * support plugging in your own ES6-compatible promises library. Mongoose 5.0
  12. * will **not** support mpromise.
  13. *
  14. * @param {Function} fn a function which will be called when the promise is resolved that accepts `fn(err, ...){}` as signature
  15. * @api public
  16. */
  17. function ES6Promise() {
  18. throw new Error('Can\'t use ES6 promise with mpromise style constructor');
  19. }
  20. ES6Promise.use = function(Promise) {
  21. ES6Promise.ES6 = Promise;
  22. };
  23. module.exports = ES6Promise;