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/test/helpers/arrayDepth.test.js | test/helpers/arrayDepth.test.js | 'use strict';
const assert = require('assert');
const arrayDepth = require('../../lib/helpers/arrayDepth');
describe('arrayDepth', function() {
it('non-array', function() {
assert.deepEqual(arrayDepth('a'), { min: 0, max: 0, containsNonArrayItem: true });
});
it('simple array with no element', function() {
... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/aggregate.test.js | test/helpers/aggregate.test.js | 'use strict';
const assert = require('assert');
const prepareDiscriminatorPipeline = require('../../lib/helpers/aggregate/prepareDiscriminatorPipeline');
const stringifyFunctionOperators = require('../../lib/helpers/aggregate/stringifyFunctionOperators');
describe('stringifyFunctionOperators', function() {
it('conv... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/query.test.js | test/helpers/query.test.js | 'use strict';
require('../common');
const assert = require('assert');
const selectPopulatedFields = require('../../lib/helpers/query/selectPopulatedFields');
describe('Query helpers', function() {
describe('selectPopulatedFields', function() {
it('handles nested populate if parent key is projected in (gh-5669)... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/isAsyncFunction.test.js | test/helpers/isAsyncFunction.test.js | 'use strict';
const assert = require('assert');
const isAsyncFunction = require('../../lib/helpers/isAsyncFunction');
describe('isAsyncFunction', function() {
it('should return false for non-functions', () => {
assert.ok(!isAsyncFunction('a'));
assert.ok(!isAsyncFunction(1));
assert.ok(!isAsyncFunction(... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/applyWriteConcern.test.js | test/helpers/applyWriteConcern.test.js | 'use strict';
const assert = require('assert');
const applyWriteConcern = require('../../lib/helpers/schema/applyWriteConcern');
const start = require('../common');
const mongoose = start.mongoose;
describe('applyWriteConcern', function() {
let db;
before(function() {
db = start();
});
after(async functio... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/clone.test.js | test/helpers/clone.test.js | 'use strict';
const assert = require('assert');
require('../common'); // required for side-effect setup (so that the default driver is set-up)
const clone = require('../../lib/helpers/clone');
const symbols = require('../../lib/helpers/symbols');
const ObjectId = require('../../lib/types/objectid');
const Decimal = r... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/populate.getSchemaTypes.test.js | test/helpers/populate.getSchemaTypes.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../common').mongoose;
const Schema = require('../../lib/schema');
const getSchemaTypes = require('../../lib/helpers/populate/getSchemaTypes');
describe('getSchemaTypes', function() {
it('handles embedded discriminators (gh-5970)', function()... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/getModelsMapForPopulate.test.js | test/helpers/getModelsMapForPopulate.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
const util = require('../util');
const mongoose = start.mongoose;
const Schema = mongoose.Schema;
describe('getModelsMapForPopulate', function() {
let db;
beforeEach(() => db.deleteModel(/.*/));
before(function() {
db = s... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/helpers/schema.getPath.test.js | test/helpers/schema.getPath.test.js | 'use strict';
const Schema = require('../../lib/schema');
const assert = require('assert');
const getPath = require('../../lib/helpers/schema/getPath');
describe('getPath()', function() {
it('works', function() {
const schema = new Schema({
docArr: [{ el: String }]
});
assert.equal(getPath(schema... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/isolated/project-has-error.toJSON.js | test/isolated/project-has-error.toJSON.js | 'use strict';
Object.defineProperty(Error.prototype, 'toJSON', {
enumerable: false,
configurable: false,
writable: false,
value: () => ({ from: 'Error' })
});
require('../../');
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/types/check-types-filename.js | test/types/check-types-filename.js | 'use strict';
const fs = require('fs');
const uppercaseRE = /[A-Z]/g;
const checkFolder = (folder) => {
const folderContent = fs.readdirSync(folder);
for (const entry of folderContent) {
if (fs.lstatSync(folder + '/' + entry).isDirectory()) {
checkFolder(folder + '/' + entry);
} else {
if (e... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/date.test.js | test/docs/date.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
describe('Date Tutorial', function() {
let User;
const mongoose = new start.mongoose.Mongoose();
before(function() {
const userSchema = new mongoose.Schema({
name: String,
// `lastActiveAt` is a date
last... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/discriminators.test.js | test/docs/discriminators.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
const Schema = mongoose.Schema;
describe('discriminator docs', function() {
let Event;
let ClickedLinkEvent;
let SignedUpEvent;
let db;
before(function() {
db = mongoose.createConnec... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/promises.test.js | test/docs/promises.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
describe('promises docs', function() {
let Band;
let db;
before(function() {
db = mongoose.createConnection(start.uri);
Band = db.model('band-promises', { name: String, members: [Str... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/custom-casting.test.js | test/docs/custom-casting.test.js | 'use strict';
const assert = require('assert');
const Mongoose = require('../../lib');
const mongoose = new Mongoose.Mongoose();
describe('custom casting', function() {
let originalCast;
beforeEach(function() {
originalCast = mongoose.Number.cast();
});
afterEach(function() {
mongoose.deleteModel('... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/debug.test.js | test/docs/debug.test.js | 'use strict';
/**
* Test dependencies.
*/
const assert = require('assert');
const start = require('../common');
const mongoose = start.mongoose;
const Schema = mongoose.Schema;
/**
* Setup.
*/
const testSchema = new Schema({
dob: Date,
title: {
type: String,
required: false
}
}, {
timestamps: {... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/cast.test.js | test/docs/cast.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
// This file is in `es-next` because it uses async/await for convenience
describe('Cast Tutorial', function() {
let Character;
const mongoose = new start.mongoose.Mongoose();
before(async function() {
const schema = new mo... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/getters-setters.test.js | test/docs/getters-setters.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
const mongoose = new start.mongoose.Mongoose();
const Schema = mongoose.Schema;
// This file is in `es-next` because it uses async/await for convenience
describe('getters/setters', function() {
before(async function() {
await ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/transactions.test.js | test/docs/transactions.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
const mongoose = start.mongoose;
const Schema = mongoose.Schema;
describe('transactions', function() {
let db;
let _skipped = false;
this.timeout(10000);
before(async function() {
if (!process.env.REPLICA_SET && !process... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/defaults.test.js | test/docs/defaults.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
describe('defaults docs', function() {
let db;
const Schema = mongoose.Schema;
before(function() {
db = mongoose.createConnection(start.uri);
});
after(async function() {
await d... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/asyncIterator.test.js | test/docs/asyncIterator.test.js | 'use strict';
/**
* Module dependencies.
*/
const assert = require('assert');
const start = require('../common');
const mongoose = start.mongoose;
describe('asyncIterator', function() {
let db;
let Movie;
before(async function() {
db = await start();
const schema = new mongoose.Schema({ name: Stri... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/schematypes.test.js | test/docs/schematypes.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
describe('schemaTypes', function() {
let db;
const Schema = mongoose.Schema;
before(function() {
db = mongoose.createConnection(start.uri);
});
after(async function() {
await db.c... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/schemas.test.js | test/docs/schemas.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
describe('Advanced Schemas', function() {
let db;
const Schema = mongoose.Schema;
before(function() {
db = mongoose.createConnection(start.uri);
});
after(async function() {
awai... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/findoneandupdate.test.js | test/docs/findoneandupdate.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
// This file is in `es-next` because it uses async/await for convenience
describe('Tutorial: findOneAndUpdate()', function() {
const mongoose = new start.mongoose.Mongoose();
let Character;
before(async function() {
await ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/validation.test.js | test/docs/validation.test.js | 'use strict';
const assert = require('assert');
const mongoose = require('../../');
const start = require('../common');
describe('validation docs', function() {
let db;
const Schema = mongoose.Schema;
before(function() {
db = mongoose.createConnection(start.uri, {
minPoolSize: 1,
maxPoolSize: 1
... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/lean.test.js | test/docs/lean.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
// This file is in `es-next` because it uses async/await for convenience
describe('Lean Tutorial', function() {
let MyModel;
const mongoose = new start.mongoose.Mongoose();
before(function() {
const schema = new mongoose.S... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/test/docs/virtuals.test.js | test/docs/virtuals.test.js | 'use strict';
const assert = require('assert');
const start = require('../common');
const mongoose = new start.mongoose.Mongoose();
// This file is in `es-next` because it uses async/await for convenience
describe('Virtuals', function() {
before(async function() {
await mongoose.connect(start.uri);
});
b... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/typescript.js | docs/source/typescript.js | 'use strict';
const { mapSubDoc } = require('./utils');
mapSubDoc('typescript', {
title: 'Mongoose:',
markdown: true
}, module.exports);
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/home.js | docs/source/home.js | 'use strict';
const pkg = require('./../../package.json');
module.exports = {
package: pkg,
title: 'ODM'
};
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/index.js | docs/source/index.js |
'use strict';
let sponsors = [];
try {
sponsors = require('../data/sponsors.json');
} catch {}
let jobs = [];
try {
jobs = require('../data/jobs.json');
} catch {}
const api = require('./api');
/**
* @typedef {Object} DocsOptions
* @property {String} title Title of the page
* @property {Boolean} [api] Indica... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/api.js | docs/source/api.js | 'use strict';
/*!
* Module dependencies
*/
const dox = require('dox');
const fs = require('fs');
const md = require('marked');
const files = [
'lib/mongoose.js',
'lib/schema.js',
'lib/connection.js',
'lib/document.js',
'lib/model.js',
'lib/query.js',
'lib/cursor/queryCursor.js',
'lib/aggregate.js',... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/tutorials.js | docs/source/tutorials.js | 'use strict';
const { mapSubDoc } = require('./utils');
mapSubDoc('tutorials', {
title: 'Mongoose Tutorials:',
acquit: true,
markdown: true
}, module.exports);
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/source/utils.js | docs/source/utils.js | 'use strict';
const fs = require('fs');
/**
* @typedef {import("./index").DocsOptions} DocsOptions
*/
/**
* Map sub-directories with custom options
* @param {String} subDoc Path to the subdoc, like "tutorials" (no beginning or ending slash)
* @param {DocsOptions} options Options applied to all files in the subdo... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/mobile-navbar-toggle.js | docs/js/mobile-navbar-toggle.js | 'use strict';
// this js is for mobile, to toggle the navbar
(function(window, document) {
const layout = document.getElementById('layout'),
menu = document.getElementById('menu'),
menuLink = document.getElementById('menuLink'),
content = document.getElementById('content');
function toggleClass(... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/navbar-search.js | docs/js/navbar-search.js | 'use strict';
(function() {
const versionFromUrl = window.location.pathname.match(/^\/docs\/(\d+\.x)/);
const version = versionFromUrl ? versionFromUrl[1] : null;
const searchPrefix = versionFromUrl ? '/docs/' + version + '/docs/' : '/docs/';
// dont use nav-bar search for search site, let the search site han... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/native.js | docs/js/native.js | 'use strict';
var _native = {
construct: function(e) {
var default_options = {
display: "block",
fallback: "",
placement: "",
prefix: "native",
targetClass: "native-ad",
visibleClass: "native-show"
};
if (typeof e == "undefined") return default_options;
Object.keys... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/copy-code.js | docs/js/copy-code.js | 'use strict';
// Attach copy-button logic only after the full DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
// Inline SVG icons so no external asset load is required
const copyIcon = `
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" wid... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/redirect-old-api.js | docs/js/redirect-old-api.js | 'use strict';
window.addEventListener('DOMContentLoaded', () => {
const anchor = window.location.hash;
// in case there is not anchor
if (!anchor) {
return redirectToBase();
}
const firstName = anchor.split('_')[0];
// in case there is no split
if (!firstName) {
return redirectToBase();
}
... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/search.js | docs/js/search.js | 'use strict';
const root = 'https://mongoose-js.netlify.app/.netlify/functions';
const defaultVersion = '9.x';
const versionFromUrl = window.location.pathname.match(/^\/docs\/(\d+\.x)/);
const version = versionFromUrl ? versionFromUrl[1] : defaultVersion;
search();
document.getElementById('search-button').onclick =... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/theme-toggle.js | docs/js/theme-toggle.js | 'use strict';
(function() {
const STORAGE_KEY = 'mongoose-theme';
const supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
const prefersDarkQuery = supportsMatchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
const theme = localStorage.getItem(STORA... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/api-bold-current-nav.js | docs/js/api-bold-current-nav.js | 'use strict';
// this script changes the nav-bar entry that is current visible on the screen as a header (most to the top) to be bold
let headers = undefined;
let curNavEntry = undefined;
let curElem = undefined;
window.addEventListener('scroll', function() {
// set these values if undefined, because otherwise in gl... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/docs/js/convert-old-anchorid.js | docs/js/convert-old-anchorid.js | 'use strict';
window.addEventListener('DOMContentLoaded', () => {
const anchor = window.location.hash;
// only operate on the old id's
if (!/^#\w+_\w+(?:-\w+)?$/i.test(anchor)) {
return fixNoAsyncFn();
}
// in case there is no anchor, return without modifying the anchor
if (!anchor) {
return;
}... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/driver.js | lib/driver.js | 'use strict';
/*!
* ignore
*/
let driver = null;
module.exports.get = function() {
return driver;
};
module.exports.set = function(v) {
driver = v;
};
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/index.js | lib/index.js | 'use strict';
/*!
* Module dependencies.
*/
const mongodbDriver = require('./drivers/node-mongodb-native');
require('./driver').set(mongodbDriver);
const mongoose = require('./mongoose');
mongoose.setDriver(mongodbDriver);
mongoose.Mongoose.prototype.mongo = require('mongodb');
module.exports = mongoose;
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/schemaType.js | lib/schemaType.js | 'use strict';
/*!
* Module dependencies.
*/
const MongooseError = require('./error/index');
const SchemaTypeOptions = require('./options/schemaTypeOptions');
const $exists = require('./schema/operators/exists');
const $type = require('./schema/operators/type');
const clone = require('./helpers/clone');
const handle... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/aggregate.js | lib/aggregate.js | 'use strict';
/*!
* Module dependencies
*/
const AggregationCursor = require('./cursor/aggregationCursor');
const MongooseError = require('./error/mongooseError');
const Query = require('./query');
const { applyGlobalMaxTimeMS, applyGlobalDiskUse } = require('./helpers/query/applyGlobalOption');
const clone = requi... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/document.js | lib/document.js | 'use strict';
/*!
* Module dependencies.
*/
const DivergentArrayError = require('./error/divergentArray');
const EventEmitter = require('events').EventEmitter;
const InternalCache = require('./internal');
const MongooseBuffer = require('./types/buffer');
const MongooseError = require('./error/index');
const MixedSc... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/mongoose.js | lib/mongoose.js | 'use strict';
/*!
* Module dependencies.
*/
const Document = require('./document');
const EventEmitter = require('events').EventEmitter;
const Kareem = require('kareem');
const Schema = require('./schema');
const SchemaType = require('./schemaType');
const SchemaTypes = require('./schema/index');
const VirtualType ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/validOptions.js | lib/validOptions.js |
/*!
* Valid mongoose options
*/
'use strict';
const VALID_OPTIONS = Object.freeze([
'allowDiskUse',
'applyPluginsToChildSchemas',
'applyPluginsToDiscriminators',
'autoCreate',
'autoIndex',
'autoSearchIndex',
'bufferCommands',
'bufferTimeoutMS',
'cloneSchemas',
'createInitialConnection',
'debu... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/collection.js | lib/collection.js | 'use strict';
/*!
* Module dependencies.
*/
const EventEmitter = require('events').EventEmitter;
const STATES = require('./connectionState');
const immediate = require('./helpers/immediate');
/**
* Abstract Collection constructor
*
* This is the base class that drivers inherit from and implement.
*
* @param {... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/queryHelpers.js | lib/queryHelpers.js | 'use strict';
/*!
* Module dependencies
*/
const PopulateOptions = require('./options/populateOptions');
const checkEmbeddedDiscriminatorKeyProjection =
require('./helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection');
const get = require('./helpers/get');
const getDiscriminatorByValue =
require('./he... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/connectionState.js | lib/connectionState.js |
/*!
* Connection states
*/
'use strict';
const STATES = module.exports = exports = Object.create(null);
const disconnected = 'disconnected';
const connected = 'connected';
const connecting = 'connecting';
const disconnecting = 'disconnecting';
const uninitialized = 'uninitialized';
STATES[0] = disconnected;
STAT... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/virtualType.js | lib/virtualType.js | 'use strict';
const modelNamesFromRefPath = require('./helpers/populate/modelNamesFromRefPath');
const utils = require('./utils');
const modelSymbol = require('./helpers/symbols').modelSymbol;
/**
* VirtualType constructor
*
* This is what mongoose uses to define virtual attributes via `Schema.prototype.virtual`.... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/constants.js | lib/constants.js | 'use strict';
/*!
* ignore
*/
const queryOperations = Object.freeze([
// Read
'countDocuments',
'distinct',
'estimatedDocumentCount',
'find',
'findOne',
// Update
'findOneAndReplace',
'findOneAndUpdate',
'replaceOne',
'updateMany',
'updateOne',
// Delete
'deleteMany',
'deleteOne',
'f... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/schema.js | lib/schema.js | 'use strict';
/*!
* Module dependencies.
*/
const EventEmitter = require('events').EventEmitter;
const Kareem = require('kareem');
const MongooseError = require('./error/mongooseError');
const SchemaType = require('./schemaType');
const SchemaTypeOptions = require('./options/schemaTypeOptions');
const VirtualOption... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/stateMachine.js | lib/stateMachine.js |
/*!
* Module dependencies.
*/
'use strict';
const utils = require('./utils'); // eslint-disable-line no-unused-vars
/**
* StateMachine represents a minimal `interface` for the
* constructors it builds via StateMachine.ctor(...).
*
* @api private
*/
const StateMachine = module.exports = exports = function St... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/query.js | lib/query.js | 'use strict';
/*!
* Module dependencies.
*/
const CastError = require('./error/cast');
const DocumentNotFoundError = require('./error/notFound');
const Kareem = require('kareem');
const MongooseError = require('./error/mongooseError');
const ObjectParameterError = require('./error/objectParameter');
const QueryCurs... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/connection.js | lib/connection.js | 'use strict';
/*!
* Module dependencies.
*/
const ChangeStream = require('./cursor/changeStream');
const EventEmitter = require('events').EventEmitter;
const Schema = require('./schema');
const STATES = require('./connectionState');
const MongooseBulkWriteError = require('./error/bulkWriteError');
const MongooseErr... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/internal.js | lib/internal.js | /*!
* Dependencies
*/
'use strict';
const StateMachine = require('./stateMachine');
const ActiveRoster = StateMachine.ctor('require', 'modify', 'init', 'default', 'ignore');
module.exports = exports = InternalCache;
function InternalCache() {
this.activePaths = new ActiveRoster();
}
InternalCache.prototype.str... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options.js | lib/options.js | 'use strict';
/*!
* ignore
*/
exports.internalToObjectOptions = {
transform: false,
virtuals: false,
getters: false,
_skipDepopulateTopLevel: true,
depopulate: true,
flattenDecimals: false,
useProjection: false,
versionKey: true,
flattenObjectIds: false
};
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/modifiedPathsSnapshot.js | lib/modifiedPathsSnapshot.js | 'use strict';
module.exports = class ModifiedPathsSnapshot {
constructor(subdocSnapshot, activePaths, version) {
this.subdocSnapshot = subdocSnapshot;
this.activePaths = activePaths;
this.version = version;
}
};
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/model.js | lib/model.js | 'use strict';
/*!
* Module dependencies.
*/
const Aggregate = require('./aggregate');
const ChangeStream = require('./cursor/changeStream');
const Document = require('./document');
const DocumentNotFoundError = require('./error/notFound');
const EventEmitter = require('events').EventEmitter;
const Kareem = require(... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | true |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast.js | lib/cast.js | 'use strict';
/*!
* Module dependencies.
*/
const CastError = require('./error/cast');
const StrictModeError = require('./error/strict');
const Types = require('./schema/index');
const cast$expr = require('./helpers/query/cast$expr');
const castString = require('./cast/string');
const castTextSearch = require('./sc... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/utils.js | lib/utils.js | 'use strict';
/*!
* Module dependencies.
*/
const UUID = require('mongodb/lib/bson').UUID;
const ms = require('ms');
const mpath = require('mpath');
const ObjectId = require('./types/objectid');
const PopulateOptions = require('./options/populateOptions');
const clone = require('./helpers/clone');
const immediate =... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/uuid.js | lib/cast/uuid.js | 'use strict';
const UUID = require('mongodb/lib/bson').UUID;
const UUID_FORMAT = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
module.exports = function castUUID(value) {
if (value == null) {
return value;
}
if (value instanceof UUID) {
return value;
}
if (typeof valu... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/string.js | lib/cast/string.js | 'use strict';
const CastError = require('../error/cast');
/**
* Given a value, cast it to a string, or throw a `CastError` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @param {String} [path] optional the path to set on the CastError
* @return {string|nul... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/objectid.js | lib/cast/objectid.js | 'use strict';
const isBsonType = require('../helpers/isBsonType');
const ObjectId = require('../types/objectid');
module.exports = function castObjectId(value) {
if (value == null) {
return value;
}
if (isBsonType(value, 'ObjectId')) {
return value;
}
if (value._id) {
if (isBsonType(value._id,... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/int32.js | lib/cast/int32.js | 'use strict';
const isBsonType = require('../helpers/isBsonType');
const assert = require('assert');
/**
* Given a value, cast it to a Int32, or throw an `Error` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @return {Number}
* @throws {Error} if `value` d... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/bigint.js | lib/cast/bigint.js | 'use strict';
const { Long } = require('mongodb/lib/bson');
/**
* Given a value, cast it to a BigInt, or throw an `Error` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @return {Number}
* @throws {Error} if `value` is not one of the allowed values
* @api ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/decimal128.js | lib/cast/decimal128.js | 'use strict';
const Decimal128Type = require('../types/decimal128');
const assert = require('assert');
module.exports = function castDecimal128(value) {
if (value == null) {
return value;
}
if (typeof value === 'object' && typeof value.$numberDecimal === 'string') {
return Decimal128Type.fromString(val... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/date.js | lib/cast/date.js | 'use strict';
const assert = require('assert');
module.exports = function castDate(value) {
// Support empty string because of empty form values. Originally introduced
// in https://github.com/Automattic/mongoose/commit/efc72a1898fc3c33a319d915b8c5463a22938dfe
if (value == null || value === '') {
return nul... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/double.js | lib/cast/double.js | 'use strict';
const assert = require('assert');
const BSON = require('mongodb/lib/bson');
const isBsonType = require('../helpers/isBsonType');
/**
* Given a value, cast it to a IEEE 754-2008 floating point, or throw an `Error` if the value
* cannot be casted. `null`, `undefined`, and `NaN` are considered valid inpu... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/number.js | lib/cast/number.js | 'use strict';
const assert = require('assert');
/**
* Given a value, cast it to a number, or throw an `Error` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @return {Number}
* @throws {Error} if `value` is not one of the allowed values
* @api private
*/
... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/cast/boolean.js | lib/cast/boolean.js | 'use strict';
const CastError = require('../error/cast');
/**
* Given a value, cast it to a boolean, or throw a `CastError` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @param {String} [path] optional the path to set on the CastError
* @return {Boolean|n... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaUnionOptions.js | lib/options/schemaUnionOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a Union schematype.
*
* @api public
* @inherits SchemaTypeOptions
* @constructor SchemaUnionOptions
*/
class SchemaUnionOptions extends SchemaTypeOptions {}
const opts = require('./propertyOptions');
/**
* I... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaMapOptions.js | lib/options/schemaMapOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a Map schematype.
*
* #### Example:
*
* const schema = new Schema({ socialMediaHandles: { type: Map, of: String } });
* schema.path('socialMediaHandles').options; // SchemaMapOptions instance
*
* @api ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaStringOptions.js | lib/options/schemaStringOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a string schematype.
*
* #### Example:
*
* const schema = new Schema({ name: String });
* schema.path('name').options; // SchemaStringOptions instance
*
* @api public
* @inherits SchemaTypeOptions
* ... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/propertyOptions.js | lib/options/propertyOptions.js | 'use strict';
module.exports = Object.freeze({
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/saveOptions.js | lib/options/saveOptions.js | 'use strict';
const clone = require('../helpers/clone');
class SaveOptions {
constructor(obj) {
if (obj == null) {
return;
}
Object.assign(this, clone(obj));
}
}
SaveOptions.prototype.__subdocs = null;
module.exports = SaveOptions;
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/virtualOptions.js | lib/options/virtualOptions.js | 'use strict';
const opts = require('./propertyOptions');
class VirtualOptions {
constructor(obj) {
Object.assign(this, obj);
if (obj?.options != null) {
this.options = Object.assign({}, obj.options);
}
}
}
/**
* Marks this virtual as a populate virtual, and specifies the model to
* use for p... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaTypeOptions.js | lib/options/schemaTypeOptions.js | 'use strict';
const clone = require('../helpers/clone');
/**
* The options defined on a schematype.
*
* #### Example:
*
* const schema = new Schema({ name: String });
* schema.path('name').options instanceof mongoose.SchemaTypeOptions; // true
*
* @api public
* @constructor SchemaTypeOptions
*/
cla... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaArrayOptions.js | lib/options/schemaArrayOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on an Array schematype.
*
* #### Example:
*
* const schema = new Schema({ tags: [String] });
* schema.path('tags').options; // SchemaArrayOptions instance
*
* @api public
* @inherits SchemaTypeOptions
*... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaDateOptions.js | lib/options/schemaDateOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a Date schematype.
*
* #### Example:
*
* const schema = new Schema({ startedAt: Date });
* schema.path('startedAt').options; // SchemaDateOptions instance
*
* @api public
* @inherits SchemaTypeOptions... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/populateOptions.js | lib/options/populateOptions.js | 'use strict';
const clone = require('../helpers/clone');
class PopulateOptions {
constructor(obj) {
this._docs = {};
this._childDocs = [];
if (obj == null) {
return;
}
obj = clone(obj);
Object.assign(this, obj);
if (typeof obj.subPopulate === 'object') {
this.populate = obj.... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaSubdocumentOptions.js | lib/options/schemaSubdocumentOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a single nested schematype.
*
* #### Example:
*
* const schema = Schema({ child: Schema({ name: String }) });
* schema.path('child').options; // SchemaSubdocumentOptions instance
*
* @api public
* @in... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaDocumentArrayOptions.js | lib/options/schemaDocumentArrayOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on an Document Array schematype.
*
* #### Example:
*
* const schema = new Schema({ users: [{ name: string }] });
* schema.path('users').options; // SchemaDocumentArrayOptions instance
*
* @api public
* @... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaBufferOptions.js | lib/options/schemaBufferOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a Buffer schematype.
*
* #### Example:
*
* const schema = new Schema({ bitmap: Buffer });
* schema.path('bitmap').options; // SchemaBufferOptions instance
*
* @api public
* @inherits SchemaTypeOptions... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaNumberOptions.js | lib/options/schemaNumberOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on a Number schematype.
*
* #### Example:
*
* const schema = new Schema({ count: Number });
* schema.path('count').options; // SchemaNumberOptions instance
*
* @api public
* @inherits SchemaTypeOptions
... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/options/schemaObjectIdOptions.js | lib/options/schemaObjectIdOptions.js | 'use strict';
const SchemaTypeOptions = require('./schemaTypeOptions');
/**
* The options defined on an ObjectId schematype.
*
* #### Example:
*
* const schema = new Schema({ testId: mongoose.ObjectId });
* schema.path('testId').options; // SchemaObjectIdOptions instance
*
* @api public
* @inherits S... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/mongooseError.js | lib/error/mongooseError.js | 'use strict';
/*!
* ignore
*/
class MongooseError extends Error { }
Object.defineProperty(MongooseError.prototype, 'name', {
value: 'MongooseError'
});
module.exports = MongooseError;
| javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/strict.js | lib/error/strict.js | /*!
* Module dependencies.
*/
'use strict';
const MongooseError = require('./mongooseError');
/**
* Strict mode error constructor
*
* @param {String} path
* @param {String} [msg]
* @param {Boolean} [immutable]
* @inherits MongooseError
* @api private
*/
class StrictModeError extends MongooseError {
co... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/bulkWriteError.js | lib/error/bulkWriteError.js | /*!
* Module dependencies.
*/
'use strict';
const MongooseError = require('./');
/**
* If `bulkWrite()` or `insertMany()` has validation errors, but
* all valid operations succeed, and 'throwOnValidationError' is true,
* Mongoose will throw this error.
*
* @api private
*/
class MongooseBulkWriteError exten... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/bulkSaveIncompleteError.js | lib/error/bulkSaveIncompleteError.js | /*!
* Module dependencies.
*/
'use strict';
const MongooseError = require('./mongooseError');
/**
* If the underwriting `bulkWrite()` for `bulkSave()` succeeded, but wasn't able to update or
* insert all documents, we throw this error.
*
* @api private
*/
class MongooseBulkSaveIncompleteError extends Mongoo... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/notFound.js | lib/error/notFound.js | 'use strict';
/*!
* Module dependencies.
*/
const MongooseError = require('./mongooseError');
const util = require('util');
/**
* OverwriteModel Error constructor.
* @api private
*/
class DocumentNotFoundError extends MongooseError {
constructor(filter, model, numAffected, result) {
let msg;
const m... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/parallelValidate.js | lib/error/parallelValidate.js | 'use strict';
/*!
* Module dependencies.
*/
const MongooseError = require('./mongooseError');
/**
* ParallelValidate Error constructor.
*
* @param {Document} doc
* @api private
*/
class ParallelValidateError extends MongooseError {
constructor(doc) {
const msg = 'Can\'t validate() the same doc multip... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/index.js | lib/error/index.js | 'use strict';
/**
* MongooseError constructor. MongooseError is the base class for all
* Mongoose-specific errors.
*
* #### Example:
*
* const Model = mongoose.model('Test', new mongoose.Schema({ answer: Number }));
* const doc = new Model({ answer: 'not a number' });
* const err = doc.validateSync... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/createCollectionsError.js | lib/error/createCollectionsError.js | 'use strict';
const MongooseError = require('./mongooseError');
/**
* createCollections Error constructor
*
* @param {String} message
* @param {String} errorsMap
* @inherits MongooseError
* @api private
*/
class CreateCollectionsError extends MongooseError {
constructor(message, errorsMap) {
super(messa... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/invalidSchemaOption.js | lib/error/invalidSchemaOption.js |
/*!
* Module dependencies.
*/
'use strict';
const MongooseError = require('./mongooseError');
/**
* InvalidSchemaOption Error constructor.
* @param {String} name
* @api private
*/
class InvalidSchemaOptionError extends MongooseError {
constructor(name, option) {
const msg = `Cannot create use schema f... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/objectParameter.js | lib/error/objectParameter.js | /*!
* Module dependencies.
*/
'use strict';
const MongooseError = require('./mongooseError');
/**
* Constructor for errors that happen when a parameter that's expected to be
* an object isn't an object
*
* @param {Any} value
* @param {String} paramName
* @param {String} fnName
* @api private
*/
class Obje... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Automattic/mongoose | https://github.com/Automattic/mongoose/blob/f5bfdb54182a1d1bbb5cea6aab87f523713d237c/lib/error/messages.js | lib/error/messages.js |
/**
* The default built-in validator error messages. These may be customized.
*
* // customize within each schema or globally like so
* const mongoose = require('mongoose');
* mongoose.Error.messages.String.enum = "Your custom message for {PATH}.";
*
* Error messages support basic templating. Mongo... | javascript | MIT | f5bfdb54182a1d1bbb5cea6aab87f523713d237c | 2026-01-04T15:02:29.296852Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.