repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/validation.js
lib/error/validation.js
/*! * Module requirements */ 'use strict'; const MongooseError = require('./mongooseError'); const getConstructorName = require('../helpers/getConstructorName'); const util = require('util'); const combinePathErrors = require('../helpers/error/combinePathErrors'); /** * Document Validation Error * * @api privat...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/syncIndexes.js
lib/error/syncIndexes.js
'use strict'; /*! * Module dependencies. */ const MongooseError = require('./mongooseError'); /** * SyncIndexes Error constructor. * * @param {String} message * @param {String} errorsMap * @inherits MongooseError * @api private */ class SyncIndexesError extends MongooseError { constructor(message, errors...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/objectExpected.js
lib/error/objectExpected.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * Strict mode error constructor * * @param {string} type * @param {string} value * @api private */ class ObjectExpectedError extends MongooseError { constructor(path, val) { const typeDescription = Array...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/strictPopulate.js
lib/error/strictPopulate.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * Strict mode error constructor * * @param {String} path * @param {String} [msg] * @inherits MongooseError * @api private */ class StrictPopulateError extends MongooseError { constructor(path, msg) { ms...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/overwriteModel.js
lib/error/overwriteModel.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * OverwriteModel Error constructor. * @param {String} name * @api private */ class OverwriteModelError extends MongooseError { constructor(name) { super('Cannot overwrite `' + name + '` model once compile...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/browserMissingSchema.js
lib/error/browserMissingSchema.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * MissingSchema Error constructor. */ class MissingSchemaError extends MongooseError { constructor() { super('Schema hasn\'t been registered for document.\n' + 'Use mongoose.Document(name, schema)'); ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/version.js
lib/error/version.js
'use strict'; /*! * Module dependencies. */ const MongooseError = require('./mongooseError'); /** * Version Error constructor. * * @param {Document} doc * @param {Number} currentVersion * @param {Array<String>} modifiedPaths * @api private */ class VersionError extends MongooseError { constructor(doc, c...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/eachAsyncMultiError.js
lib/error/eachAsyncMultiError.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * If `eachAsync()` is called with `continueOnError: true`, there can be * multiple errors. This error class contains an `errors` property, which * contains an array of all errors that occurred in `eachAsync()`. *...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/serverSelection.js
lib/error/serverSelection.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); const allServersUnknown = require('../helpers/topology/allServersUnknown'); const isAtlas = require('../helpers/topology/isAtlas'); const isSSLError = require('../helpers/topology/isSSLError'); /*! * ignore */ const at...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/divergentArray.js
lib/error/divergentArray.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * DivergentArrayError constructor. * @param {Array<String>} paths * @api private */ class DivergentArrayError extends MongooseError { constructor(paths) { const msg = 'For your own good, using `document.s...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/setOptionError.js
lib/error/setOptionError.js
/*! * Module requirements */ 'use strict'; const MongooseError = require('./mongooseError'); const util = require('util'); const combinePathErrors = require('../helpers/error/combinePathErrors'); /** * Mongoose.set Error * * @api private * @inherits MongooseError */ class SetOptionError extends MongooseError...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/cast.js
lib/error/cast.js
'use strict'; /*! * Module dependencies. */ const MongooseError = require('./mongooseError'); const util = require('util'); /** * Casting Error constructor. * * @param {String} type * @param {String} value * @inherits MongooseError * @api private */ class CastError extends MongooseError { constructor(typ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/parallelSave.js
lib/error/parallelSave.js
'use strict'; /*! * Module dependencies. */ const MongooseError = require('./mongooseError'); /** * ParallelSave Error constructor. * * @param {Document} doc * @api private */ class ParallelSaveError extends MongooseError { constructor(doc) { const msg = 'Can\'t save() the same doc multiple times in ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/missingSchema.js
lib/error/missingSchema.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * MissingSchema Error constructor. * @param {String} name * @api private */ class MissingSchemaError extends MongooseError { constructor(name) { const msg = 'Schema hasn\'t been registered for model "' + ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/validator.js
lib/error/validator.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('./mongooseError'); /** * Schema validator error * * @param {Object} properties * @param {Document} doc * @api private */ class ValidatorError extends MongooseError { constructor(properties, doc) { let msg = properties.message;...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cursor/queryCursor.js
lib/cursor/queryCursor.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('../error/mongooseError'); const Readable = require('stream').Readable; const eachAsync = require('../helpers/cursor/eachAsync'); const helpers = require('../queryHelpers'); const kareem = require('kareem'); const immediate = require('../help...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cursor/changeStream.js
lib/cursor/changeStream.js
'use strict'; /*! * Module dependencies. */ const EventEmitter = require('events').EventEmitter; const MongooseError = require('../error/mongooseError'); /*! * ignore */ const driverChangeStreamEvents = ['close', 'change', 'end', 'error', 'resumeTokenChanged']; /*! * ignore */ class ChangeStream extends Eve...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cursor/aggregationCursor.js
lib/cursor/aggregationCursor.js
/*! * Module dependencies. */ 'use strict'; const MongooseError = require('../error/mongooseError'); const Readable = require('stream').Readable; const eachAsync = require('../helpers/cursor/eachAsync'); const immediate = require('../helpers/immediate'); const kareem = require('kareem'); const util = require('util'...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/printJestWarning.js
lib/helpers/printJestWarning.js
'use strict'; const utils = require('../utils'); if (typeof jest !== 'undefined' && !process.env.SUPPRESS_JEST_WARNINGS) { if (typeof window !== 'undefined') { utils.warn('Mongoose: looks like you\'re trying to test a Mongoose app ' + 'with Jest\'s default jsdom test environment. Please make sure you read...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isPromise.js
lib/helpers/isPromise.js
'use strict'; function isPromise(val) { return !!val && (typeof val === 'object' || typeof val === 'function') && typeof val.then === 'function'; } module.exports = isPromise;
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/symbols.js
lib/helpers/symbols.js
'use strict'; exports.arrayAtomicsBackupSymbol = Symbol('mongoose#Array#atomicsBackup'); exports.arrayAtomicsSymbol = Symbol('mongoose#Array#_atomics'); exports.arrayParentSymbol = Symbol('mongoose#Array#_parent'); exports.arrayPathSymbol = Symbol('mongoose#Array#_path'); exports.arraySchemaSymbol = Symbol('mongoose#A...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/getFunctionName.js
lib/helpers/getFunctionName.js
'use strict'; const functionNameRE = /^function\s*([^\s(]+)/; module.exports = function(fn) { return ( fn.name || (fn.toString().trim().match(functionNameRE) || [])[1] ); };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/firstKey.js
lib/helpers/firstKey.js
'use strict'; module.exports = function firstKey(obj) { if (obj == null) { return null; } return Object.keys(obj)[0]; };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/minimize.js
lib/helpers/minimize.js
'use strict'; const { isPOJO } = require('../utils'); module.exports = minimize; /** * Minimizes an object, removing undefined values and empty objects * * @param {Object} object to minimize * @return {Object|undefined} * @api private */ function minimize(obj) { const keys = Object.keys(obj); let i = keys...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/specialProperties.js
lib/helpers/specialProperties.js
'use strict'; module.exports = new Set(['__proto__', 'constructor', 'prototype']);
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/once.js
lib/helpers/once.js
'use strict'; module.exports = function once(fn) { let called = false; return function() { if (called) { return; } called = true; return fn.apply(null, arguments); }; };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/setDefaultsOnInsert.js
lib/helpers/setDefaultsOnInsert.js
'use strict'; const get = require('./get'); /** * Applies defaults to update and findOneAndUpdate operations. * * @param {Object} filter * @param {Schema} schema * @param {Object} castedDoc * @param {Object} options * @method setDefaultsOnInsert * @api private */ module.exports = function(filter, schema, cas...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isSimpleValidator.js
lib/helpers/isSimpleValidator.js
'use strict'; /** * Determines if `arg` is a flat object. * * @param {Object|Array|String|Function|RegExp|any} arg * @api private * @return {Boolean} */ module.exports = function isSimpleValidator(obj) { const keys = Object.keys(obj); let result = true; for (let i = 0, len = keys.length; i < len; ++i) { ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/clone.js
lib/helpers/clone.js
'use strict'; const Decimal = require('../types/decimal128'); const ObjectId = require('../types/objectid'); const specialProperties = require('./specialProperties'); const isMongooseObject = require('./isMongooseObject'); const getFunctionName = require('./getFunctionName'); const isBsonType = require('./isBsonType')...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/updateValidators.js
lib/helpers/updateValidators.js
'use strict'; /*! * Module dependencies. */ const ValidationError = require('../error/validation'); const cleanPositionalOperators = require('./schema/cleanPositionalOperators'); const flatten = require('./common').flatten; /** * Applies validators and defaults to update and findOneAndUpdate operations, * specif...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/parallelLimit.js
lib/helpers/parallelLimit.js
'use strict'; module.exports = parallelLimit; /*! * ignore */ async function parallelLimit(params, fn, limit) { if (limit <= 0) { throw new Error('Limit must be positive'); } if (params.length === 0) { return []; } const results = []; const executing = new Set(); for (let index = 0; index ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/getDefaultBulkwriteResult.js
lib/helpers/getDefaultBulkwriteResult.js
'use strict'; function getDefaultBulkwriteResult() { return { ok: 1, nInserted: 0, nUpserted: 0, nMatched: 0, nModified: 0, nRemoved: 0, upserted: [], writeErrors: [], insertedIds: [], writeConcernErrors: [] }; } module.exports = getDefaultBulkwriteResult;
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/getConstructorName.js
lib/helpers/getConstructorName.js
'use strict'; /** * If `val` is an object, returns constructor name, if possible. Otherwise returns undefined. * @api private */ module.exports = function getConstructorName(val) { if (val == null) { return void 0; } if (typeof val.constructor !== 'function') { return void 0; } return val.constru...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/arrayDepth.js
lib/helpers/arrayDepth.js
'use strict'; module.exports = arrayDepth; function arrayDepth(arr) { if (!Array.isArray(arr)) { return { min: 0, max: 0, containsNonArrayItem: true }; } if (arr.length === 0) { return { min: 1, max: 1, containsNonArrayItem: false }; } if (arr.length === 1 && !Array.isArray(arr[0])) { return { m...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isPOJO.js
lib/helpers/isPOJO.js
'use strict'; module.exports = function isPOJO(arg) { if (arg == null || typeof arg !== 'object') { return false; } const proto = Object.getPrototypeOf(arg); // Prototype may be null if you used `Object.create(null)` // Checking `proto`'s constructor is safe because `getPrototypeOf()` // explicitly cro...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isObject.js
lib/helpers/isObject.js
'use strict'; /** * Determines if `arg` is an object. * * @param {Object|Array|String|Function|RegExp|any} arg * @api private * @return {Boolean} */ module.exports = function(arg) { return ( Buffer.isBuffer(arg) || Object.prototype.toString.call(arg) === '[object Object]' ); };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/common.js
lib/helpers/common.js
'use strict'; /*! * Module dependencies. */ const Binary = require('mongodb/lib/bson').Binary; const isBsonType = require('./isBsonType'); const isMongooseObject = require('./isMongooseObject'); const MongooseError = require('../error'); const util = require('util'); exports.flatten = flatten; exports.modifiedPath...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isBsonType.js
lib/helpers/isBsonType.js
'use strict'; /** * Get the bson type, if it exists * @api private */ function isBsonType(obj, typename) { return ( obj != null && obj._bsontype === typename ); } module.exports = isBsonType;
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/each.js
lib/helpers/each.js
'use strict'; module.exports = function each(arr, cb, done) { if (arr.length === 0) { return done(); } let remaining = arr.length; let err = null; for (const v of arr) { cb(v, function(_err) { if (err != null) { return; } if (_err != null) { err = _err; retu...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/immediate.js
lib/helpers/immediate.js
/*! * Centralize this so we can more easily work around issues with people * stubbing out `process.nextTick()` in tests using sinon: * https://github.com/sinonjs/lolex#automatically-incrementing-mocked-time * See gh-6074 */ 'use strict'; const nextTick = typeof process !== 'undefined' && typeof process.nextTick ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/processConnectionOptions.js
lib/helpers/processConnectionOptions.js
'use strict'; const clone = require('./clone'); const MongooseError = require('../error/index'); function processConnectionOptions(uri, options) { const opts = options ? options : {}; const readPreference = opts.readPreference ? opts.readPreference : getUriReadPreference(uri); const clonedOpts = clone(...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/pluralize.js
lib/helpers/pluralize.js
'use strict'; module.exports = pluralize; /** * Pluralization rules. */ exports.pluralization = [ [/human$/gi, 'humans'], [/(m|wom)an$/gi, '$1en'], [/(pe)rson$/gi, '$1ople'], [/(child)$/gi, '$1ren'], [/^(ox)$/gi, '$1en'], [/(ax|test)is$/gi, '$1es'], [/(octop|cact|foc|fung|nucle)us$/gi, '$1i'], [/(a...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/createJSONSchemaTypeDefinition.js
lib/helpers/createJSONSchemaTypeDefinition.js
'use strict'; /** * Handles creating `{ type: 'object' }` vs `{ bsonType: 'object' }` vs `{ bsonType: ['object', 'null'] }` * * @param {String} type * @param {String} bsonType * @param {Boolean} useBsonType * @param {Boolean} isRequired */ module.exports = function createJSONSchemaTypeArray(type, bsonType, use...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/timers.js
lib/helpers/timers.js
'use strict'; exports.setTimeout = setTimeout;
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/omitUndefined.js
lib/helpers/omitUndefined.js
'use strict'; module.exports = function omitUndefined(val) { if (val == null || typeof val !== 'object') { return val; } if (Array.isArray(val)) { for (let i = val.length - 1; i >= 0; --i) { if (val[i] === undefined) { val.splice(i, 1); } } } for (const key of Object.keys(val)...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isMongooseObject.js
lib/helpers/isMongooseObject.js
'use strict'; const isMongooseArray = require('../types/array/isMongooseArray').isMongooseArray; /** * Returns if `v` is a mongoose object that has a `toObject()` method we can use. * * This is for compatibility with libs like Date.js which do foolish things to Natives. * * @param {Any} v * @api private */ mod...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/isAsyncFunction.js
lib/helpers/isAsyncFunction.js
'use strict'; module.exports = function isAsyncFunction(v) { return ( typeof v === 'function' && v.constructor && v.constructor.name === 'AsyncFunction' ); };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/get.js
lib/helpers/get.js
'use strict'; /** * Simplified lodash.get to work around the annoying null quirk. See: * https://github.com/lodash/lodash/issues/3659 * @api private */ module.exports = function get(obj, path, def) { let parts; let isPathArray = false; if (typeof path === 'string') { if (path.indexOf('.') === -1) { ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/handleImmutable.js
lib/helpers/query/handleImmutable.js
'use strict'; const StrictModeError = require('../../error/strict'); /** * Handle immutable option for a given path when casting updates based on options * * @param {SchemaType} schematype the resolved schematype for this path * @param {Boolean | 'throw' | null} strict whether strict mode is set for this query *...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/sanitizeFilter.js
lib/helpers/query/sanitizeFilter.js
'use strict'; const hasDollarKeys = require('./hasDollarKeys'); const { trustedSymbol } = require('./trusted'); module.exports = function sanitizeFilter(filter) { if (filter == null || typeof filter !== 'object') { return filter; } if (Array.isArray(filter)) { for (const subfilter of filter) { san...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/hasDollarKeys.js
lib/helpers/query/hasDollarKeys.js
'use strict'; /*! * ignore */ module.exports = function hasDollarKeys(obj) { if (typeof obj !== 'object' || obj === null) { return false; } const keys = Object.keys(obj); const len = keys.length; for (let i = 0; i < len; ++i) { if (keys[i][0] === '$') { return true; } } return fa...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/cast$expr.js
lib/helpers/query/cast$expr.js
'use strict'; const CastError = require('../../error/cast'); const StrictModeError = require('../../error/strict'); const castNumber = require('../../cast/number'); const omitUndefined = require('../omitUndefined'); const booleanComparison = new Set(['$and', '$or']); const comparisonOperator = new Set(['$cmp', '$eq',...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/getEmbeddedDiscriminatorPath.js
lib/helpers/query/getEmbeddedDiscriminatorPath.js
'use strict'; const cleanPositionalOperators = require('../schema/cleanPositionalOperators'); const get = require('../get'); const getDiscriminatorByValue = require('../discriminator/getDiscriminatorByValue'); const updatedPathsByArrayFilter = require('../update/updatedPathsByArrayFilter'); /** * Like `schema.path()...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/handleReadPreferenceAliases.js
lib/helpers/query/handleReadPreferenceAliases.js
'use strict'; module.exports = function handleReadPreferenceAliases(pref) { switch (pref) { case 'p': pref = 'primary'; break; case 'pp': pref = 'primaryPreferred'; break; case 's': pref = 'secondary'; break; case 'sp': pref = 'secondaryPreferred'; brea...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/castFilterPath.js
lib/helpers/query/castFilterPath.js
'use strict'; const isOperator = require('./isOperator'); module.exports = function castFilterPath(ctx, schematype, val) { const any$conditionals = Object.keys(val).some(isOperator); if (!any$conditionals) { return schematype.castForQuery( null, val, ctx ); } const ks = Object.keys...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/trusted.js
lib/helpers/query/trusted.js
'use strict'; const trustedSymbol = Symbol('mongoose#trustedSymbol'); exports.trustedSymbol = trustedSymbol; exports.trusted = function trusted(obj) { if (obj == null || typeof obj !== 'object') { return obj; } obj[trustedSymbol] = true; return obj; };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/castUpdate.js
lib/helpers/query/castUpdate.js
'use strict'; const CastError = require('../../error/cast'); const MongooseError = require('../../error/mongooseError'); const SchemaString = require('../../schema/string'); const StrictModeError = require('../../error/strict'); const ValidationError = require('../../error/validation'); const castNumber = require('../...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/isOperator.js
lib/helpers/query/isOperator.js
'use strict'; const specialKeys = new Set([ '$ref', '$id', '$db' ]); module.exports = function isOperator(path) { return ( path[0] === '$' && !specialKeys.has(path) ); };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/sanitizeProjection.js
lib/helpers/query/sanitizeProjection.js
'use strict'; module.exports = function sanitizeProjection(projection) { if (projection == null) { return; } const keys = Object.keys(projection); for (let i = 0; i < keys.length; ++i) { if (typeof projection[keys[i]] === 'string') { projection[keys[i]] = 1; } } };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/applyGlobalOption.js
lib/helpers/query/applyGlobalOption.js
'use strict'; const utils = require('../../utils'); function applyGlobalMaxTimeMS(options, connectionOptions, baseOptions) { applyGlobalOption(options, connectionOptions, baseOptions, 'maxTimeMS'); } function applyGlobalDiskUse(options, connectionOptions, baseOptions) { applyGlobalOption(options, connectionOptio...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/validOps.js
lib/helpers/query/validOps.js
'use strict'; module.exports = require('../../constants').queryMiddlewareFunctions;
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/query/selectPopulatedFields.js
lib/helpers/query/selectPopulatedFields.js
'use strict'; const isExclusive = require('../projection/isExclusive'); const isInclusive = require('../projection/isInclusive'); /*! * ignore */ module.exports = function selectPopulatedFields(fields, userProvidedFields, populateOptions) { if (populateOptions == null) { return; } const paths = Object.k...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/error/combinePathErrors.js
lib/helpers/error/combinePathErrors.js
'use strict'; /*! * ignore */ module.exports = function combinePathErrors(err) { const keys = Object.keys(err.errors || {}); const len = keys.length; const msgs = []; let key; for (let i = 0; i < len; ++i) { key = keys[i]; if (err === err.errors[key]) { continue; } msgs.push(key + '...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/cursor/eachAsync.js
lib/helpers/cursor/eachAsync.js
'use strict'; /*! * Module dependencies. */ const EachAsyncMultiError = require('../../error/eachAsyncMultiError'); const immediate = require('../immediate'); /** * Execute `fn` for every document in the cursor. If `fn` returns a promise, * will wait for the promise to resolve before iterating on to the next one...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/discriminator.js
lib/helpers/model/discriminator.js
'use strict'; const Mixed = require('../../schema/mixed'); const applyBuiltinPlugins = require('../schema/applyBuiltinPlugins'); const clone = require('../clone'); const defineKey = require('../document/compile').defineKey; const get = require('../get'); const utils = require('../../utils'); const mergeDiscriminatorSc...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/applyDefaultsToPOJO.js
lib/helpers/model/applyDefaultsToPOJO.js
'use strict'; module.exports = function applyDefaultsToPOJO(doc, schema) { const paths = Object.keys(schema.paths); const plen = paths.length; for (let i = 0; i < plen; ++i) { let curPath = ''; const p = paths[i]; const type = schema.paths[p]; const path = type.splitPath(); const len = path...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/castBulkWrite.js
lib/helpers/model/castBulkWrite.js
'use strict'; const MongooseError = require('../../error/mongooseError'); const getDiscriminatorByValue = require('../../helpers/discriminator/getDiscriminatorByValue'); const applyTimestampsToChildren = require('../update/applyTimestampsToChildren'); const applyTimestampsToUpdate = require('../update/applyTimestampsT...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/decorateBulkWriteResult.js
lib/helpers/model/decorateBulkWriteResult.js
'use strict'; module.exports = function decorateBulkWriteResult(resultOrError, validationErrors, results) { resultOrError.mongoose = resultOrError.mongoose || {}; resultOrError.mongoose.validationErrors = validationErrors; resultOrError.mongoose.results = results; return resultOrError; };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/applyStatics.js
lib/helpers/model/applyStatics.js
'use strict'; /** * Register statics for this model * @param {Model} model * @param {Schema} schema * @api private */ module.exports = function applyStatics(model, schema) { for (const i in schema.statics) { model[i] = schema.statics[i]; } };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/applyHooks.js
lib/helpers/model/applyHooks.js
'use strict'; /*! * ignore */ module.exports = applyHooks; /*! * ignore */ applyHooks.middlewareFunctions = [ 'deleteOne', 'remove', 'save', 'updateOne', 'validate', 'init' ]; /*! * ignore */ const alreadyHookedFunctions = new Set(applyHooks.middlewareFunctions.flatMap(fn => ([fn, `$__${fn}`])))...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/applyMethods.js
lib/helpers/model/applyMethods.js
'use strict'; const get = require('../get'); const utils = require('../../utils'); /** * Register methods for this model * * @param {Model} model * @param {Schema} schema * @api private */ module.exports = function applyMethods(model, schema) { const Model = require('../../model'); function apply(method, ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/pushNestedArrayPaths.js
lib/helpers/model/pushNestedArrayPaths.js
'use strict'; module.exports = function pushNestedArrayPaths(paths, nestedArray, path) { if (nestedArray == null) { return; } for (let i = 0; i < nestedArray.length; ++i) { if (Array.isArray(nestedArray[i])) { pushNestedArrayPaths(paths, nestedArray[i], path + '.' + i); } else { paths.pu...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/model/applyStaticHooks.js
lib/helpers/model/applyStaticHooks.js
'use strict'; const { queryMiddlewareFunctions, aggregateMiddlewareFunctions, modelMiddlewareFunctions, documentMiddlewareFunctions } = require('../../constants'); const middlewareFunctions = Array.from( new Set([ ...queryMiddlewareFunctions, ...aggregateMiddlewareFunctions, ...modelMiddlewareFunctions,...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js
lib/helpers/discriminator/getSchemaDiscriminatorByValue.js
'use strict'; const areDiscriminatorValuesEqual = require('./areDiscriminatorValuesEqual'); /** * returns discriminator by discriminatorMapping.value * * @param {Schema} schema * @param {string} value * @api private */ module.exports = function getSchemaDiscriminatorByValue(schema, value) { if (schema?.discr...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/applyEmbeddedDiscriminators.js
lib/helpers/discriminator/applyEmbeddedDiscriminators.js
'use strict'; module.exports = applyEmbeddedDiscriminators; function applyEmbeddedDiscriminators(schema, seen = new WeakSet(), overwriteExisting = false) { if (seen.has(schema)) { return; } seen.add(schema); for (const path of Object.keys(schema.paths)) { const schemaType = schema.paths[path]; if ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/getConstructor.js
lib/helpers/discriminator/getConstructor.js
'use strict'; const getDiscriminatorByValue = require('./getDiscriminatorByValue'); /** * Find the correct constructor, taking into account discriminators * @api private */ module.exports = function getConstructor(Constructor, value, defaultDiscriminatorValue) { const discriminatorKey = Constructor.schema.optio...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/getDiscriminatorByValue.js
lib/helpers/discriminator/getDiscriminatorByValue.js
'use strict'; const areDiscriminatorValuesEqual = require('./areDiscriminatorValuesEqual'); /** * returns discriminator by discriminatorMapping.value * * @param {Object} discriminators * @param {string} value * @api private */ module.exports = function getDiscriminatorByValue(discriminators, value) { if (dis...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/areDiscriminatorValuesEqual.js
lib/helpers/discriminator/areDiscriminatorValuesEqual.js
'use strict'; const isBsonType = require('../isBsonType'); module.exports = function areDiscriminatorValuesEqual(a, b) { if (typeof a === 'string' && typeof b === 'string') { return a === b; } if (typeof a === 'number' && typeof b === 'number') { return a === b; } if (isBsonType(a, 'ObjectId') && is...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/mergeDiscriminatorSchema.js
lib/helpers/discriminator/mergeDiscriminatorSchema.js
'use strict'; const schemaMerge = require('../schema/merge'); const specialProperties = require('../../helpers/specialProperties'); const isBsonType = require('../../helpers/isBsonType'); const ObjectId = require('../../types/objectid'); const SchemaType = require('../../schemaType'); const isObject = require('../../he...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection.js
lib/helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection.js
'use strict'; module.exports = function checkEmbeddedDiscriminatorKeyProjection(userProjection, path, schema, selected, addedPaths) { const userProjectedInPath = Object.keys(userProjection). reduce((cur, key) => cur || key.startsWith(path + '.'), false); const _discriminatorKey = path + '.' + schema.options.di...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isPathSelectedInclusive.js
lib/helpers/projection/isPathSelectedInclusive.js
'use strict'; /*! * ignore */ module.exports = function isPathSelectedInclusive(fields, path) { const chunks = path.split('.'); let cur = ''; let j; let keys; let numKeys; for (let i = 0; i < chunks.length; ++i) { cur += cur.length ? '.' : '' + chunks[i]; if (fields[cur]) { keys = Object.k...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/hasIncludedChildren.js
lib/helpers/projection/hasIncludedChildren.js
'use strict'; /** * Creates an object that precomputes whether a given path has child fields in * the projection. * * #### Example: * * const res = hasIncludedChildren({ 'a.b.c': 0 }); * res.a; // 1 * res['a.b']; // 1 * res['a.b.c']; // 1 * res['a.c']; // undefined * * @param {Object} f...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isInclusive.js
lib/helpers/projection/isInclusive.js
'use strict'; const isDefiningProjection = require('./isDefiningProjection'); const isPOJO = require('../isPOJO'); /*! * ignore */ module.exports = function isInclusive(projection) { if (projection == null) { return false; } const props = Object.keys(projection); const numProps = props.length; if (n...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isExclusive.js
lib/helpers/projection/isExclusive.js
'use strict'; const isDefiningProjection = require('./isDefiningProjection'); const isPOJO = require('../isPOJO'); /*! * ignore */ module.exports = function isExclusive(projection) { if (projection == null) { return null; } const keys = Object.keys(projection); let exclude = null; if (keys.length =...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isSubpath.js
lib/helpers/projection/isSubpath.js
'use strict'; /** * Determines if `path2` is a subpath of or equal to `path1` * * @param {string} path1 * @param {string} path2 * @return {Boolean} * @api private */ module.exports = function isSubpath(path1, path2) { return path1 === path2 || path2.startsWith(path1 + '.'); };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isNestedProjection.js
lib/helpers/projection/isNestedProjection.js
'use strict'; module.exports = function isNestedProjection(val) { if (val == null || typeof val !== 'object') { return false; } return val.$slice == null && val.$elemMatch == null && val.$meta == null && val.$ == null; };
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/parseProjection.js
lib/helpers/projection/parseProjection.js
'use strict'; /** * Convert a string or array into a projection object, retaining all * `-` and `+` paths. */ module.exports = function parseProjection(v, retainMinusPaths) { const type = typeof v; if (type === 'string') { v = v.split(/\s+/); } if (!Array.isArray(v) && Object.prototype.toString.call(v...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/applyProjection.js
lib/helpers/projection/applyProjection.js
'use strict'; const hasIncludedChildren = require('./hasIncludedChildren'); const isExclusive = require('./isExclusive'); const isInclusive = require('./isInclusive'); const isPOJO = require('../../utils').isPOJO; module.exports = function applyProjection(doc, projection, _hasIncludedChildren) { if (projection == n...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isPathExcluded.js
lib/helpers/projection/isPathExcluded.js
'use strict'; const isDefiningProjection = require('./isDefiningProjection'); /** * Determines if `path` is excluded by `projection` * * @param {Object} projection * @param {String} path * @return {Boolean} * @api private */ module.exports = function isPathExcluded(projection, path) { if (projection == null...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/projection/isDefiningProjection.js
lib/helpers/projection/isDefiningProjection.js
'use strict'; /*! * ignore */ module.exports = function isDefiningProjection(val) { if (val == null) { // `undefined` or `null` become exclusive projections return true; } if (typeof val === 'object') { // Only cases where a value does **not** define whether the whole projection // is inclusiv...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/topology/isAtlas.js
lib/helpers/topology/isAtlas.js
'use strict'; const getConstructorName = require('../getConstructorName'); /** * @typedef { import('mongodb').TopologyDescription } TopologyDescription */ /** * Checks if topologyDescription contains servers connected to an atlas instance * * @param {TopologyDescription} topologyDescription * @returns {boolea...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/topology/allServersUnknown.js
lib/helpers/topology/allServersUnknown.js
'use strict'; const getConstructorName = require('../getConstructorName'); module.exports = function allServersUnknown(topologyDescription) { if (getConstructorName(topologyDescription) !== 'TopologyDescription') { return false; } const servers = Array.from(topologyDescription.servers.values()); return s...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/topology/isSSLError.js
lib/helpers/topology/isSSLError.js
'use strict'; const getConstructorName = require('../getConstructorName'); const nonSSLMessage = 'Client network socket disconnected before secure TLS ' + 'connection was established'; module.exports = function isSSLError(topologyDescription) { if (getConstructorName(topologyDescription) !== 'TopologyDescription...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/aggregate/stringifyFunctionOperators.js
lib/helpers/aggregate/stringifyFunctionOperators.js
'use strict'; module.exports = function stringifyFunctionOperators(pipeline) { if (!Array.isArray(pipeline)) { return; } for (const stage of pipeline) { if (stage == null) { continue; } const canHaveAccumulator = stage.$group || stage.$bucket || stage.$bucketAuto; if (canHaveAccumulat...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/aggregate/prepareDiscriminatorPipeline.js
lib/helpers/aggregate/prepareDiscriminatorPipeline.js
'use strict'; module.exports = function prepareDiscriminatorPipeline(pipeline, schema, prefix) { const discriminatorMapping = schema?.discriminatorMapping; prefix = prefix || ''; if (discriminatorMapping && !discriminatorMapping.isRoot) { const originalPipeline = pipeline; const filterKey = (prefix.leng...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/populate/assignRawDocsToIdStructure.js
lib/helpers/populate/assignRawDocsToIdStructure.js
'use strict'; const clone = require('../../helpers/clone'); const leanPopulateMap = require('./leanPopulateMap'); const modelSymbol = require('../symbols').modelSymbol; const utils = require('../../utils'); module.exports = assignRawDocsToIdStructure; const kHasArray = Symbol('mongoose#assignRawDocsToIdStructure#has...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/populate/validateRef.js
lib/helpers/populate/validateRef.js
'use strict'; const MongooseError = require('../../error/mongooseError'); const util = require('util'); module.exports = validateRef; function validateRef(ref, path) { if (typeof ref === 'string') { return; } if (typeof ref === 'function') { return; } throw new MongooseError('Invalid ref at path ...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/populate/getSchemaTypes.js
lib/helpers/populate/getSchemaTypes.js
'use strict'; /*! * ignore */ const Mixed = require('../../schema/mixed'); const get = require('../get'); const getDiscriminatorByValue = require('../discriminator/getDiscriminatorByValue'); const leanPopulateMap = require('./leanPopulateMap'); const mpath = require('mpath'); const populateModelSymbol = require('....
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/populate/leanPopulateMap.js
lib/helpers/populate/leanPopulateMap.js
'use strict'; /*! * ignore */ module.exports = new WeakMap();
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false
Automattic/mongoose
https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/helpers/populate/assignVals.js
lib/helpers/populate/assignVals.js
'use strict'; const MongooseMap = require('../../types/map'); const SkipPopulateValue = require('./skipPopulateValue'); const assignRawDocsToIdStructure = require('./assignRawDocsToIdStructure'); const get = require('../get'); const getVirtual = require('./getVirtual'); const leanPopulateMap = require('./leanPopulateM...
javascript
MIT
f5bfdb54182a1d1bbb5cea6aab87f523713d237c
2026-01-04T15:02:29.296852Z
false