mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
48
node_modules/mongoose/lib/browserDocument.js
generated
vendored
48
node_modules/mongoose/lib/browserDocument.js
generated
vendored
@@ -2,26 +2,14 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var NodeJSDocument = require('./document')
|
||||
, EventEmitter = require('events').EventEmitter
|
||||
, setMaxListeners = EventEmitter.prototype.setMaxListeners
|
||||
, MongooseError = require('./error')
|
||||
, MixedSchema = require('./schema/mixed')
|
||||
, Schema = require('./schema')
|
||||
, ObjectId = require('./types/objectid')
|
||||
, ValidatorError = require('./schematype').ValidatorError
|
||||
, utils = require('./utils')
|
||||
, clone = utils.clone
|
||||
, isMongooseObject = utils.isMongooseObject
|
||||
, inspect = require('util').inspect
|
||||
, ValidationError = MongooseError.ValidationError
|
||||
, InternalCache = require('./internal')
|
||||
, deepEqual = utils.deepEqual
|
||||
, hooks = require('hooks-fixed')
|
||||
, Promise = require('./promise')
|
||||
, DocumentArray
|
||||
, MongooseArray
|
||||
, Embedded
|
||||
var NodeJSDocument = require('./document'),
|
||||
EventEmitter = require('events').EventEmitter,
|
||||
MongooseError = require('./error'),
|
||||
Schema = require('./schema'),
|
||||
ObjectId = require('./types/objectid'),
|
||||
utils = require('./utils'),
|
||||
ValidationError = MongooseError.ValidationError,
|
||||
InternalCache = require('./internal');
|
||||
|
||||
/**
|
||||
* Document constructor.
|
||||
@@ -30,17 +18,17 @@ var NodeJSDocument = require('./document')
|
||||
* @param {Object} [fields] optional object containing the fields which were selected in the query returning this document and any populated paths data
|
||||
* @param {Boolean} [skipId] bool, should we auto create an ObjectId _id
|
||||
* @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||
* @event `init`: Emitted on a document after it has was retreived from the db and fully hydrated by Mongoose.
|
||||
* @event `init`: Emitted on a document after it has was retrieved from the db and fully hydrated by Mongoose.
|
||||
* @event `save`: Emitted when the document is successfully saved
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Document (obj, schema, fields, skipId, skipInit) {
|
||||
function Document(obj, schema, fields, skipId, skipInit) {
|
||||
if ( !(this instanceof Document) )
|
||||
return new Document( obj, schema, fields, skipId, skipInit );
|
||||
|
||||
|
||||
if (utils.isObject(schema) && !(schema instanceof Schema)) {
|
||||
if (utils.isObject(schema) && !schema.instanceOfSchema) {
|
||||
schema = new Schema(schema);
|
||||
}
|
||||
|
||||
@@ -48,15 +36,15 @@ function Document (obj, schema, fields, skipId, skipInit) {
|
||||
schema = this.schema || schema;
|
||||
|
||||
// Generate ObjectId if it is missing, but it requires a scheme
|
||||
if ( !this.schema && schema.options._id ){
|
||||
if ( !this.schema && schema.options._id ) {
|
||||
obj = obj || {};
|
||||
|
||||
if ( obj._id === undefined ){
|
||||
if ( obj._id === undefined ) {
|
||||
obj._id = new ObjectId();
|
||||
}
|
||||
}
|
||||
|
||||
if ( !schema ){
|
||||
if ( !schema ) {
|
||||
throw new MongooseError.MissingSchemaError();
|
||||
}
|
||||
|
||||
@@ -82,21 +70,21 @@ function Document (obj, schema, fields, skipId, skipInit) {
|
||||
this.$__.activePaths.require(required[i]);
|
||||
}
|
||||
|
||||
setMaxListeners.call(this, 0);
|
||||
this.$__.emitter.setMaxListeners(0);
|
||||
this._doc = this.$__buildDoc(obj, fields, skipId);
|
||||
|
||||
if ( !skipInit && obj ){
|
||||
if ( !skipInit && obj ) {
|
||||
this.init( obj );
|
||||
}
|
||||
|
||||
this.$__registerHooksFromSchema();
|
||||
|
||||
// apply methods
|
||||
for ( var m in schema.methods ){
|
||||
for ( var m in schema.methods ) {
|
||||
this[ m ] = schema.methods[ m ];
|
||||
}
|
||||
// apply statics
|
||||
for ( var s in schema.statics ){
|
||||
for ( var s in schema.statics ) {
|
||||
this[ s ] = schema.statics[ s ];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user