123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- /* eslint-env browser */
- 'use strict';
- require('./driver').set(require('./drivers/browser'));
- const DocumentProvider = require('./document_provider.js');
- const PromiseProvider = require('./promise_provider');
- DocumentProvider.setBrowser(true);
- /**
- * The Mongoose [Promise](#promise_Promise) constructor.
- *
- * @method Promise
- * @api public
- */
- Object.defineProperty(exports, 'Promise', {
- get: function() {
- return PromiseProvider.get();
- },
- set: function(lib) {
- PromiseProvider.set(lib);
- }
- });
- /**
- * Storage layer for mongoose promises
- *
- * @method PromiseProvider
- * @api public
- */
- exports.PromiseProvider = PromiseProvider;
- /**
- * The [MongooseError](#error_MongooseError) constructor.
- *
- * @method Error
- * @api public
- */
- exports.Error = require('./error');
- /**
- * The Mongoose [Schema](#schema_Schema) constructor
- *
- * ####Example:
- *
- * var mongoose = require('mongoose');
- * var Schema = mongoose.Schema;
- * var CatSchema = new Schema(..);
- *
- * @method Schema
- * @api public
- */
- exports.Schema = require('./schema');
- /**
- * The various Mongoose Types.
- *
- * ####Example:
- *
- * var mongoose = require('mongoose');
- * var array = mongoose.Types.Array;
- *
- * ####Types:
- *
- * - [ObjectId](#types-objectid-js)
- * - [Buffer](#types-buffer-js)
- * - [SubDocument](#types-embedded-js)
- * - [Array](#types-array-js)
- * - [DocumentArray](#types-documentarray-js)
- *
- * Using this exposed access to the `ObjectId` type, we can construct ids on demand.
- *
- * var ObjectId = mongoose.Types.ObjectId;
- * var id1 = new ObjectId;
- *
- * @property Types
- * @api public
- */
- exports.Types = require('./types');
- /**
- * The Mongoose [VirtualType](#virtualtype_VirtualType) constructor
- *
- * @method VirtualType
- * @api public
- */
- exports.VirtualType = require('./virtualtype');
- /**
- * The various Mongoose SchemaTypes.
- *
- * ####Note:
- *
- * _Alias of mongoose.Schema.Types for backwards compatibility._
- *
- * @property SchemaTypes
- * @see Schema.SchemaTypes #schema_Schema.Types
- * @api public
- */
- exports.SchemaType = require('./schematype.js');
- /**
- * Internal utils
- *
- * @property utils
- * @api private
- */
- exports.utils = require('./utils.js');
- /**
- * The Mongoose browser [Document](#document-js) constructor.
- *
- * @method Document
- * @api public
- */
- exports.Document = DocumentProvider();
- /**
- * function stub for model
- *
- * @method model
- * @api public
- * @return null
- */
- exports.model = function() {
- return null;
- };
- /*!
- * Module exports.
- */
- if (typeof window !== 'undefined') {
- window.mongoose = module.exports;
- window.Buffer = Buffer;
- }
|