browser.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* eslint-env browser */
  2. var PromiseProvider = require('./promise_provider');
  3. /**
  4. * The Mongoose [Promise](#promise_Promise) constructor.
  5. *
  6. * @method Promise
  7. * @api public
  8. */
  9. Object.defineProperty(exports, 'Promise', {
  10. get: function() {
  11. return PromiseProvider.get();
  12. },
  13. set: function(lib) {
  14. PromiseProvider.set(lib);
  15. }
  16. });
  17. /**
  18. * Storage layer for mongoose promises
  19. *
  20. * @method PromiseProvider
  21. * @api public
  22. */
  23. exports.PromiseProvider = PromiseProvider;
  24. /**
  25. * The [MongooseError](#error_MongooseError) constructor.
  26. *
  27. * @method Error
  28. * @api public
  29. */
  30. exports.Error = require('./error');
  31. /**
  32. * The Mongoose [Schema](#schema_Schema) constructor
  33. *
  34. * ####Example:
  35. *
  36. * var mongoose = require('mongoose');
  37. * var Schema = mongoose.Schema;
  38. * var CatSchema = new Schema(..);
  39. *
  40. * @method Schema
  41. * @api public
  42. */
  43. exports.Schema = require('./schema');
  44. /**
  45. * The various Mongoose Types.
  46. *
  47. * ####Example:
  48. *
  49. * var mongoose = require('mongoose');
  50. * var array = mongoose.Types.Array;
  51. *
  52. * ####Types:
  53. *
  54. * - [ObjectId](#types-objectid-js)
  55. * - [Buffer](#types-buffer-js)
  56. * - [SubDocument](#types-embedded-js)
  57. * - [Array](#types-array-js)
  58. * - [DocumentArray](#types-documentarray-js)
  59. *
  60. * Using this exposed access to the `ObjectId` type, we can construct ids on demand.
  61. *
  62. * var ObjectId = mongoose.Types.ObjectId;
  63. * var id1 = new ObjectId;
  64. *
  65. * @property Types
  66. * @api public
  67. */
  68. exports.Types = require('./types');
  69. /**
  70. * The Mongoose [VirtualType](#virtualtype_VirtualType) constructor
  71. *
  72. * @method VirtualType
  73. * @api public
  74. */
  75. exports.VirtualType = require('./virtualtype');
  76. /**
  77. * The various Mongoose SchemaTypes.
  78. *
  79. * ####Note:
  80. *
  81. * _Alias of mongoose.Schema.Types for backwards compatibility._
  82. *
  83. * @property SchemaTypes
  84. * @see Schema.SchemaTypes #schema_Schema.Types
  85. * @api public
  86. */
  87. exports.SchemaType = require('./schematype.js');
  88. /**
  89. * Internal utils
  90. *
  91. * @property utils
  92. * @api private
  93. */
  94. exports.utils = require('./utils.js');
  95. /**
  96. * The Mongoose browser [Document](#document-js) constructor.
  97. *
  98. * @method Document
  99. * @api public
  100. */
  101. exports.Document = require('./document_provider.js')();
  102. /*!
  103. * Module exports.
  104. */
  105. if (typeof window !== 'undefined') {
  106. window.mongoose = module.exports;
  107. window.Buffer = Buffer;
  108. }