Socket
Socket
Sign inDemoInstall

@andrewscwei/mongodb-odm

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@andrewscwei/mongodb-odm - npm Package Compare versions

Comparing version 0.25.0 to 0.26.0

274

build/core/Model.d.ts

@@ -7,5 +7,6 @@ /**

*/
import { Collection, ObjectID } from 'mongodb';
import { AggregationPipeline, Document, DocumentFragment, ModelCountOptions, ModelDeleteManyOptions, ModelDeleteOneOptions, ModelFindManyOptions, ModelFindOneOptions, ModelInsertManyOptions, ModelInsertOneOptions, ModelRandomFieldsOptions, ModelReplaceOneOptions, ModelUpdateManyOptions, ModelUpdateOneOptions, ModelValidateDocumentOptions, PipelineFactoryOptions, PipelineFactorySpecs, Query, Schema, Update } from '../types';
declare abstract class Model {
import { Collection, FilterQuery, ObjectID, UpdateQuery } from 'mongodb';
import { Document, ModelCountOptions, ModelDeleteManyOptions, ModelDeleteOneOptions, ModelFindManyOptions, ModelFindOneOptions, ModelInsertManyOptions, ModelInsertOneOptions, ModelRandomFieldsOptions, ModelReplaceOneOptions, ModelUpdateManyOptions, ModelUpdateOneOptions, ModelValidateDocumentOptions, PipelineFactoryOptions, PipelineFactorySpecs, Query, Schema, Update } from '../types';
declare const _default: <T = {}>(schema: Schema<T>) => {
new (): {};
/**

@@ -15,3 +16,3 @@ * Schema of this model. This property must be overridden in the derived

*/
static schema: Schema;
schema: Schema<T>;
/**

@@ -26,3 +27,3 @@ * Gets the MongoDB collection associated with this model.

*/
static getCollection(): Promise<Collection>;
getCollection(): Promise<Collection<any>>;
/**

@@ -40,3 +41,3 @@ * Generates random fields for this model. By default, only fields that are

*/
static randomFields<T = {}>(fixedFields?: DocumentFragment<T>, { includeOptionals }?: ModelRandomFieldsOptions): Promise<DocumentFragment<T>>;
randomFields(fixedFields?: Partial<Document<T>>, { includeOptionals }?: ModelRandomFieldsOptions): Promise<Partial<Document<T>>>;
/**

@@ -54,3 +55,46 @@ * Generates an aggregation pipeline specifically for the schema associated

*/
static pipeline<T = {}>(queryOrSpecs?: Query<T> | PipelineFactorySpecs, options?: PipelineFactoryOptions): AggregationPipeline;
pipeline(queryOrSpecs?: string | ObjectID | {
[key: string]: any;
} | PipelineFactorySpecs | { [P in keyof T]?: T[P] | {
[key: string]: any;
$eq?: T[P] | undefined;
$gt?: T[P] | undefined;
$gte?: T[P] | undefined;
$in?: T[P][] | undefined;
$lt?: T[P] | undefined;
$lte?: T[P] | undefined;
$ne?: T[P] | undefined;
$nin?: T[P][] | undefined;
$and?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$or?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$not?: T[P] | ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined; } | undefined, options?: PipelineFactoryOptions | undefined): import("../types").AggregationStageDescriptor[];
/**

@@ -67,3 +111,3 @@ * Identifies the ObjectID of exactly one document matching the given query.

*/
static identifyOneStrict(query: Query): Promise<ObjectID>;
identifyOneStrict(query: Query<{}>): Promise<ObjectID>;
/**

@@ -79,3 +123,3 @@ * Same as the strict identify one operation but this method swallows all

*/
static identifyOne(query: Query): Promise<null | ObjectID>;
identifyOne(query: Query<{}>): Promise<ObjectID | null>;
/**

@@ -88,3 +132,5 @@ * Returns an array of document IDs that match the query.

*/
static identifyMany(query?: Query): Promise<ObjectID[]>;
identifyMany(query?: string | ObjectID | {
[key: string]: any;
} | {} | undefined): Promise<ObjectID[]>;
/**

@@ -101,3 +147,46 @@ * Finds one document from this collection using the aggregation framework. If

*/
static findOneStrict<T = {}, R = T>(query?: Query<T>, options?: ModelFindOneOptions): Promise<Document<R>>;
findOneStrict<R = T>(query?: string | ObjectID | {
[key: string]: any;
} | { [P in keyof T]?: T[P] | {
[key: string]: any;
$eq?: T[P] | undefined;
$gt?: T[P] | undefined;
$gte?: T[P] | undefined;
$in?: T[P][] | undefined;
$lt?: T[P] | undefined;
$lte?: T[P] | undefined;
$ne?: T[P] | undefined;
$nin?: T[P][] | undefined;
$and?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$or?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$not?: T[P] | ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined; } | undefined, options?: ModelFindOneOptions | undefined): Promise<Document<R>>;
/**

@@ -114,3 +203,46 @@ * Same as the strict find one operation but this method swallows all errors

*/
static findOne<T = {}, R = T>(query?: Query<T>, options?: ModelFindOneOptions): Promise<null | Document<R>>;
findOne<R = T>(query?: string | ObjectID | {
[key: string]: any;
} | { [P in keyof T]?: T[P] | {
[key: string]: any;
$eq?: T[P] | undefined;
$gt?: T[P] | undefined;
$gte?: T[P] | undefined;
$in?: T[P][] | undefined;
$lt?: T[P] | undefined;
$lte?: T[P] | undefined;
$ne?: T[P] | undefined;
$nin?: T[P][] | undefined;
$and?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$or?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$not?: T[P] | ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined; } | undefined, options?: ModelFindOneOptions | undefined): Promise<Document<R> | null>;
/**

@@ -125,3 +257,46 @@ * Finds multiple documents of this collection using the aggregation

*/
static findMany<T = {}, R = T>(query?: Query<T>, options?: ModelFindManyOptions): Promise<Document<R>[]>;
findMany<R = T>(query?: string | ObjectID | {
[key: string]: any;
} | { [P in keyof T]?: T[P] | {
[key: string]: any;
$eq?: T[P] | undefined;
$gt?: T[P] | undefined;
$gte?: T[P] | undefined;
$in?: T[P][] | undefined;
$lt?: T[P] | undefined;
$lte?: T[P] | undefined;
$ne?: T[P] | undefined;
$nin?: T[P][] | undefined;
$and?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$or?: ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$not?: T[P] | ({
[key: string]: any;
} | T[P] | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined; } | undefined, options?: ModelFindManyOptions | undefined): Promise<Document<R>[]>;
/**

@@ -143,3 +318,3 @@ * Inserts one document into this model's collection. If `doc` is not

*/
static insertOneStrict<T>(doc?: DocumentFragment<T>, options?: ModelInsertOneOptions): Promise<Document<T>>;
insertOneStrict(doc?: Partial<Document<T>> | undefined, options?: ModelInsertOneOptions | undefined): Promise<Document<T>>;
/**

@@ -156,3 +331,3 @@ * Same as the strict insert one operation except this method swallows all

*/
static insertOne<T>(doc?: DocumentFragment<T>, options?: ModelInsertOneOptions): Promise<null | Document<T>>;
insertOne(doc?: Partial<Document<T>> | undefined, options?: ModelInsertOneOptions | undefined): Promise<Document<T> | null>;
/**

@@ -175,3 +350,3 @@ * Inserts multiple documents into this model's collection.

*/
static insertMany<T = {}>(docs: DocumentFragment<T>[], options?: ModelInsertManyOptions): Promise<Document<T>[]>;
insertMany(docs: Partial<Document<T>>[], options?: ModelInsertManyOptions): Promise<Document<T>[]>;
/**

@@ -201,3 +376,3 @@ * Updates one document matched by `query` with `update` object. Note that if

*/
static updateOneStrict<T = {}>(query: Query<T>, update: Update<T>, options?: ModelUpdateOneOptions): Promise<void | Document<T>>;
updateOneStrict(query: Query<T>, update: Update<T>, options?: ModelUpdateOneOptions): Promise<void | Document<T>>;
/**

@@ -219,3 +394,3 @@ * Same as the strict update one operation except this method swallows all

*/
static updateOne<T = {}>(query: Query<T>, update: Update<T>, options?: ModelUpdateOneOptions): Promise<boolean | null | Document<T>>;
updateOne(query: Query<T>, update: Update<T>, options?: ModelUpdateOneOptions): Promise<boolean | Document<T> | null>;
/**

@@ -241,3 +416,3 @@ * Updates multiple documents matched by `query` with `update` object.

*/
static updateMany<T = {}>(query: Query<T>, update: Update<T>, options?: ModelUpdateManyOptions): Promise<Document<T>[] | boolean>;
updateMany(query: Query<T>, update: Update<T>, options?: ModelUpdateManyOptions): Promise<boolean | Document<T>[]>;
/**

@@ -261,3 +436,3 @@ * Deletes one document matched by `query`.

*/
static deleteOneStrict<T = {}>(query: Query<T>, options?: ModelDeleteOneOptions): Promise<Document<T> | void>;
deleteOneStrict(query: Query<T>, options?: ModelDeleteOneOptions): Promise<void | Document<T>>;
/**

@@ -275,3 +450,3 @@ * Same as the strict delete one operation except this method swallows all

*/
static deleteOne<T = {}>(query: Query<T>, options?: ModelDeleteOneOptions): Promise<Document<T> | null | boolean>;
deleteOne(query: Query<T>, options?: ModelDeleteOneOptions): Promise<boolean | Document<T> | null>;
/**

@@ -293,3 +468,3 @@ * Deletes multiple documents matched by `query`.

*/
static deleteMany<T = {}>(query: Query<T>, options?: ModelDeleteManyOptions): Promise<boolean | Document<T>[]>;
deleteMany(query: Query<T>, options?: ModelDeleteManyOptions): Promise<boolean | Document<T>[]>;
/**

@@ -312,3 +487,3 @@ * Replaces one document with another. If `replacement` is not specified,

*/
static findAndReplaceOneStrict<T = {}>(query: Query<T>, replacement?: DocumentFragment<T>, options?: ModelReplaceOneOptions): Promise<Document<T>>;
findAndReplaceOneStrict(query: Query<T>, replacement?: Partial<Document<T>> | undefined, options?: ModelReplaceOneOptions): Promise<Document<T>>;
/**

@@ -327,3 +502,3 @@ * Same as the strict find and replace one operation except this method

*/
static findAndReplaceOne<T = {}>(query: Query<T>, replacement?: DocumentFragment<T>, options?: ModelReplaceOneOptions): Promise<null | Document<T>>;
findAndReplaceOne(query: Query<T>, replacement?: Partial<Document<T>> | undefined, options?: ModelReplaceOneOptions): Promise<Document<T> | null>;
/**

@@ -336,3 +511,3 @@ * Checks if a document exists.

*/
static exists(query: Query): Promise<boolean>;
exists(query: Query<{}>): Promise<boolean>;
/**

@@ -345,3 +520,3 @@ * Counts the documents that match the provided query.

*/
static count(query: Query, options?: ModelCountOptions): Promise<number>;
count(query: Query<{}>, options?: ModelCountOptions): Promise<number>;
/**

@@ -356,3 +531,3 @@ * Returns a document whose values are formatted according to the format

*/
static formatDocument<T = {}>(doc: DocumentFragment<T>): Promise<DocumentFragment<T>>;
formatDocument(doc: Partial<Document<T>>): Promise<Partial<Document<T>>>;
/**

@@ -382,3 +557,3 @@ * Validates a document for this collection. It checks for the following in

*/
static validateDocument<T = {}>(doc: DocumentFragment<T>, options?: ModelValidateDocumentOptions): Promise<boolean>;
validateDocument(doc: Partial<Document<T>>, options?: ModelValidateDocumentOptions): Promise<boolean>;
/**

@@ -395,3 +570,3 @@ * Handler called before an attempt to insert document into the database. This

*/
static willInsertDocument<T>(doc: DocumentFragment<T>): Promise<DocumentFragment<T>>;
willInsertDocument(doc: Partial<Document<T>>): Promise<Partial<Document<T>>>;
/**

@@ -402,3 +577,3 @@ * Handler called after the document is successfully inserted.

*/
static didInsertDocument<T>(doc: Document<T>): Promise<void>;
didInsertDocument<R = T>(doc: Document<R>): Promise<void>;
/**

@@ -413,3 +588,3 @@ * Handler called before an attempted update operation. This method must

*/
static willUpdateDocument<T>(query: Query<T>, update: Update<T>): Promise<[Query, Update<T>]>;
willUpdateDocument(query: Query<T>, update: Update<T>): Promise<[Query<{}>, Update<T>]>;
/**

@@ -424,3 +599,3 @@ * Handler called after a document or a set of documents have been

*/
static didUpdateDocument<T>(prevDoc?: Document<T>, newDocs?: Document<T> | Document<T>[]): Promise<void>;
didUpdateDocument(prevDoc?: Document<T> | undefined, newDocs?: Document<T> | Document<T>[] | undefined): Promise<void>;
/**

@@ -433,3 +608,3 @@ * Handler called before an attempt to delete a document.

*/
static willDeleteDocument<T>(query: Query<T>): Promise<Query<T>>;
willDeleteDocument(query: Query<T>): Promise<Query<T>>;
/**

@@ -441,3 +616,3 @@ * Handler called after a document or a set of documents are successfully

*/
static didDeleteDocument<T>(docs?: Document<T> | Document<T>[]): Promise<void>;
didDeleteDocument(docs?: Document<T> | Document<T>[] | undefined): Promise<void>;
/**

@@ -452,3 +627,3 @@ * Processes a document before it is inserted. This is also used during an

*/
private static beforeInsert;
beforeInsert(doc: Partial<Document<T>>, options?: ModelInsertOneOptions | ModelInsertManyOptions): Promise<Partial<Document<T>>>;
/**

@@ -459,3 +634,3 @@ * Handler invoked right after a document insertion.

*/
private static afterInsert;
afterInsert<R>(doc: Document<R>): Promise<void>;
/**

@@ -474,3 +649,3 @@ * Handler invoked right before an update. This is NOT invoked on an

*/
private static beforeUpdate;
beforeUpdate(query: Query<T>, update: Update<T>, options?: ModelUpdateOneOptions | ModelUpdateManyOptions): Promise<[Partial<Document<T>>, UpdateQuery<Partial<Document<T>>>]>;
/**

@@ -483,3 +658,3 @@ * Handler invoked right after an update. This does not account for

*/
private static afterUpdate;
afterUpdate(oldDoc?: Document<T> | undefined, newDocs?: Document<T> | Document<T>[] | undefined): Promise<void>;
/**

@@ -491,3 +666,3 @@ * Handler invoked right before a deletion.

*/
private static beforeDelete;
beforeDelete(query: Query<T>, options: ModelDeleteOneOptions | ModelDeleteManyOptions): Promise<FilterQuery<T>>;
/**

@@ -500,3 +675,3 @@ * Handler invoked right after a deletion.

*/
private static afterDelete;
afterDelete(docs?: Document<T> | Document<T>[] | undefined): Promise<void>;
/**

@@ -511,12 +686,9 @@ * Deletes documents from other collections that have a foreign key to this

*/
private static cascadeDelete;
/**
* Prevent instantiation of this class or any of its sub-classes because this
* is intended to be a static class.
*
* @throws {Error} Attempting to instantiate this model even though it is
* meant to be a static class.
*/
constructor();
}
export default Model;
cascadeDelete(docId: ObjectID): Promise<void>;
};
/**
* Creates a static model class with the provided schema.
*
* @returns Static model class.
*/
export default _default;

2092

build/core/Model.js

@@ -42,1092 +42,1102 @@ "use strict";

const log = debug_1.default('mongodb-odm:model');
class Model {
/**
* Gets the MongoDB collection associated with this model.
*
* @returns The MongoDB collection.
*
* @see getCollection()
*
* @throws {Error} Model class has no static property `schema` defined.
*/
static getCollection() {
return __awaiter(this, void 0, void 0, function* () {
/**
* Creates a static model class with the provided schema.
*
* @returns Static model class.
*/
exports.default = (schema) => { var _a; return _a = class {
/**
* Prevent instantiation of this class or any of its sub-classes because this
* is intended to be a static class.
*
* @throws {Error} Attempting to instantiate this model even though it is
* meant to be a static class.
*/
constructor() {
throw new Error('This is a static class and is prohibited from instantiated');
}
/**
* Gets the MongoDB collection associated with this model.
*
* @returns The MongoDB collection.
*
* @see getCollection()
*
* @throws {Error} Model class has no static property `schema` defined.
*/
static getCollection() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.schema)
throw new Error('This model has no schema, you must define this static property in the derived class');
return __1.getCollection(this.schema.collection);
});
}
/**
* Generates random fields for this model. By default, only fields that are
* marked as required and has a random() function defined will have random
* values generated. Specify `includeOptionals` to generate unrequired fields
* as well.
*
* @param fixedFields - A collection of fields that must be present in the
* output.
* @param options - @see ModelRandomFieldsOptions
*
* @returns A collection of fields whose values are randomly generated.
*/
static randomFields(fixedFields = {}, { includeOptionals = false } = {}) {
return __awaiter(this, void 0, void 0, function* () {
const o = {};
const fields = this.schema.fields;
for (const key in fields) {
if (!fields.hasOwnProperty(key))
continue;
// If key is already present in the fixed fields, omit.
if (o.hasOwnProperty(key))
continue;
const fieldSpecs = fields[key];
// If `includeOptionals` is not set, skip all the optional fields.
if (!includeOptionals && !fieldSpecs.required)
continue;
// Use provided random function if provided in the schema.
if (fieldSpecs.random)
o[key] = fieldSpecs.random();
}
for (const key in fixedFields) {
if (!fixedFields.hasOwnProperty(key))
continue;
o[key] = fixedFields[key];
}
return o;
});
}
/**
* Generates an aggregation pipeline specifically for the schema associated
* with this schema.
*
* @param queryOrSpecs - This is either a query for the $match stage or specs
* for the aggregation factory function.
* @param options - @see PipelineFactoryOptions
*
* @returns Aggregation pipeline.
*
* @throws {Error} Model class has no static property `schema` defined.
*/
static pipeline(queryOrSpecs, options) {
if (!this.schema)
throw new Error('This model has no schema, you must define this static proerty in the derived class');
return __1.getCollection(this.schema.collection);
});
}
/**
* Generates random fields for this model. By default, only fields that are
* marked as required and has a random() function defined will have random
* values generated. Specify `includeOptionals` to generate unrequired fields
* as well.
*
* @param fixedFields - A collection of fields that must be present in the
* output.
* @param options - @see ModelRandomFieldsOptions
*
* @returns A collection of fields whose values are randomly generated.
*/
static randomFields(fixedFields = {}, { includeOptionals = false } = {}) {
return __awaiter(this, void 0, void 0, function* () {
const o = {};
const fields = this.schema.fields;
for (const key in fields) {
if (!fields.hasOwnProperty(key))
continue;
// If key is already present in the fixed fields, omit.
if (o.hasOwnProperty(key))
continue;
const fieldSpecs = fields[key];
// If `includeOptionals` is not set, skip all the optional fields.
if (!includeOptionals && !fieldSpecs.required)
continue;
// Use provided random function if provided in the schema.
if (fieldSpecs.random)
o[key] = fieldSpecs.random();
// Check if the argument conforms to aggregation factory specs.
if (queryOrSpecs && Object.keys(queryOrSpecs).some(val => val.startsWith('$'))) {
return Aggregation_1.default.pipelineFactory(this.schema, queryOrSpecs, options);
}
for (const key in fixedFields) {
if (!fixedFields.hasOwnProperty(key))
continue;
o[key] = fixedFields[key];
// Otherwise the argument is a query for the $match stage.
else {
return Aggregation_1.default.pipelineFactory(this.schema, { $match: queryOrSpecs }, options);
}
return o;
});
}
/**
* Generates an aggregation pipeline specifically for the schema associated
* with this schema.
*
* @param queryOrSpecs - This is either a query for the $match stage or specs
* for the aggregation factory function.
* @param options - @see PipelineFactoryOptions
*
* @returns Aggregation pipeline.
*
* @throws {Error} Model class has no static property `schema` defined.
*/
static pipeline(queryOrSpecs, options) {
if (!this.schema)
throw new Error('This model has no schema, you must define this static proerty in the derived class');
// Check if the argument conforms to aggregation factory specs.
if (queryOrSpecs && Object.keys(queryOrSpecs).some(val => val.startsWith('$'))) {
return Aggregation_1.default.pipelineFactory(this.schema, queryOrSpecs, options);
}
// Otherwise the argument is a query for the $match stage.
else {
return Aggregation_1.default.pipelineFactory(this.schema, { $match: queryOrSpecs }, options);
/**
* Identifies the ObjectID of exactly one document matching the given query.
* Error is thrown if the document cannot be identified.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The matching ObjectID.
*
* @throws {Error} No document is found with the given query.
* @throws {Error} ID of the found document is not a valid ObjectID.
*/
static identifyOneStrict(query) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.findOne(query);
if (is_1.default.nullOrUndefined(result))
throw new Error(`No results found while identifying this ${this.schema.model} using the query ${JSON.stringify(query, null, 0)}`);
if (!mongodb_1.ObjectID.isValid(result._id))
throw new Error(`ID of ${result} is not a valid ObjectID`);
return result._id;
});
}
}
/**
* Identifies the ObjectID of exactly one document matching the given query.
* Error is thrown if the document cannot be identified.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The matching ObjectID.
*
* @throws {Error} No document is found with the given query.
* @throws {Error} ID of the found document is not a valid ObjectID.
*/
static identifyOneStrict(query) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.findOne(query);
if (is_1.default.nullOrUndefined(result))
throw new Error(`No results found while identifying this ${this.schema.model} using the query ${JSON.stringify(query, null, 0)}`);
if (!mongodb_1.ObjectID.isValid(result._id))
throw new Error(`ID of ${result} is not a valid ObjectID`);
return result._id;
});
}
/**
* Same as the strict identify one operation but this method swallows all
* errors and returns `null` if document canot be identified.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The matching ObjectID.
*
* @see Model.identifyOneStrict
*/
static identifyOne(query) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.identifyOneStrict(query);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Returns an array of document IDs that match the query.
*
* @param query - Query for this model.
*
* @returns Array of matching IDs.
*/
static identifyMany(query) {
return __awaiter(this, void 0, void 0, function* () {
const collection = yield this.getCollection();
const res = yield collection.aggregate([
...this.pipeline(query),
{
$group: {
_id: null,
ids: { $addToSet: '$_id' },
/**
* Same as the strict identify one operation but this method swallows all
* errors and returns `null` if document canot be identified.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The matching ObjectID.
*
* @see Model.identifyOneStrict
*/
static identifyOne(query) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.identifyOneStrict(query);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Returns an array of document IDs that match the query.
*
* @param query - Query for this model.
*
* @returns Array of matching IDs.
*/
static identifyMany(query) {
return __awaiter(this, void 0, void 0, function* () {
const collection = yield this.getCollection();
const res = yield collection.aggregate([
...this.pipeline(query),
{
$group: {
_id: null,
ids: { $addToSet: '$_id' },
},
},
},
]).toArray();
if (res.length === 0)
return [];
return res[0].ids || [];
});
}
/**
* Finds one document from this collection using the aggregation framework. If
* no query is specified, a random document will be fetched.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching document as the fulfillment value.
*
* @throws {Error} No document found.
*/
static findOneStrict(query, options) {
return __awaiter(this, void 0, void 0, function* () {
if (is_1.default.nullOrUndefined(query)) {
]).toArray();
if (res.length === 0)
return [];
return res[0].ids || [];
});
}
/**
* Finds one document from this collection using the aggregation framework. If
* no query is specified, a random document will be fetched.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching document as the fulfillment value.
*
* @throws {Error} No document found.
*/
static findOneStrict(query, options) {
return __awaiter(this, void 0, void 0, function* () {
if (is_1.default.nullOrUndefined(query)) {
const collection = yield this.getCollection();
const results = yield collection.aggregate(this.pipeline(query).concat([{ $sample: { size: 1 } }])).toArray();
if (results.length !== 1)
throw new Error('More or less than 1 random document found even though only 1 was supposed to be found.');
return results[0];
}
else {
const results = yield this.findMany(query, options);
if (results.length === 0)
throw new Error('No document found with provided query');
return results[0];
}
});
}
/**
* Same as the strict find one operation but this method swallows all errors
* and returns `null` when no document is found.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching document as the fulfillment value.
*
* @see Model.findOneStrict
*/
static findOne(query, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.findOneStrict(query, options);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Finds multiple documents of this collection using the aggregation
* framework. If no query is specified, all documents are fetched.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching documents as the fulfillment value.
*/
static findMany(query, options) {
return __awaiter(this, void 0, void 0, function* () {
const collection = yield this.getCollection();
const results = yield collection.aggregate(this.pipeline(query).concat([{ $sample: { size: 1 } }])).toArray();
if (results.length !== 1)
throw new Error('More or less than 1 random document found even though only 1 was supposed to be found.');
return results[0];
}
else {
const results = yield this.findMany(query, options);
if (results.length === 0)
throw new Error('No document found with provided query');
return results[0];
}
});
}
/**
* Same as the strict find one operation but this method swallows all errors
* and returns `null` when no document is found.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching document as the fulfillment value.
*
* @see Model.findOneStrict
*/
static findOne(query, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.findOneStrict(query, options);
const results = yield collection.aggregate(this.pipeline(query), options).toArray();
return results;
});
}
/**
* Inserts one document into this model's collection. If `doc` is not
* specified, random fields will be generated.
*
* @param doc - Document to be inserted. @see module:mongodb.Collection#insertOne
* @param options - @see ModelInsertOneOptions
*
* @returns The inserted document.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#insertOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult}
*
* @throws {Error} This method is called even though insertions are disabled
* in the schema.
* @throws {MongoError} collection#insertOne failed.
*/
static insertOneStrict(doc, options) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noInserts === true)
throw new Error('Insertions are disallowed for this model');
// Apply before insert handler.
const t = yield this.beforeInsert(doc || (yield this.randomFields()), Object.assign({ strict: true }, options));
log(`${this.schema.model}.insertOne:`, JSON.stringify(t, null, 0));
const collection = yield this.getCollection();
const results = yield collection.insertOne(t, options).catch(error => { throw error; });
log(`${this.schema.model}.insertOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
assert_1.default(results.ops.length <= 1, new Error('Somehow insertOne() op inserted more than 1 document'));
if (results.ops.length < 1)
throw new Error('Unable to insert document');
const o = results.ops[0];
// Apply after insert handler.
yield this.afterInsert(o);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Finds multiple documents of this collection using the aggregation
* framework. If no query is specified, all documents are fetched.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
* @param options - @see module:mongodb.Collection#aggregate
*
* @returns The matching documents as the fulfillment value.
*/
static findMany(query, options) {
return __awaiter(this, void 0, void 0, function* () {
const collection = yield this.getCollection();
const results = yield collection.aggregate(this.pipeline(query), options).toArray();
return results;
});
}
/**
* Inserts one document into this model's collection. If `doc` is not
* specified, random fields will be generated.
*
* @param doc - Document to be inserted. @see module:mongodb.Collection#insertOne
* @param options - @see ModelInsertOneOptions
*
* @returns The inserted document.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#insertOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult}
*
* @throws {Error} This method is called even though insertions are disabled
* in the schema.
* @throws {MongoError} collection#insertOne failed.
*/
static insertOneStrict(doc, options) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noInserts === true)
throw new Error('Insertions are disallowed for this model');
// Apply before insert handler.
const t = yield this.beforeInsert(doc || (yield this.randomFields()), Object.assign({ strict: true }, options));
log(`${this.schema.model}.insertOne:`, JSON.stringify(t, null, 0));
const collection = yield this.getCollection();
const results = yield collection.insertOne(t, options).catch(error => { throw error; });
log(`${this.schema.model}.insertOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
assert_1.default(results.ops.length <= 1, new Error('Somehow insertOne() op inserted more than 1 document'));
if (results.ops.length < 1)
throw new Error('Unable to insert document');
const o = results.ops[0];
// Apply after insert handler.
yield this.afterInsert(o);
return o;
});
}
/**
* Same as the strict insert one operation except this method swallows all
* errors and returns null if the document cannot be inserted.
*
* @param doc - Document to be inserted. @see module:mongodb.Collection#insertOne
* @param options - @see ModelInsertOneOptions
*
* @returns The inserted document.
*
* @see Model.insertOneStrict
*/
static insertOne(doc, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.insertOneStrict(doc, options);
});
}
/**
* Same as the strict insert one operation except this method swallows all
* errors and returns null if the document cannot be inserted.
*
* @param doc - Document to be inserted. @see module:mongodb.Collection#insertOne
* @param options - @see ModelInsertOneOptions
*
* @returns The inserted document.
*
* @see Model.insertOneStrict
*/
static insertOne(doc, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.insertOneStrict(doc, options);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Inserts multiple documents into this model's collection.
*
* @param docs - Array of documents to insert. @see module:mongodb.Collection#insertMany
* @param options - @see module:mongodb.Collection#insertMany
*
* @returns The inserted documents.
*
* @todo This method iterates through every document to apply the beforeInsert
* hook. Consider a more cost-efficient approach?
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#insertMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult}
*
* @throws {Error} This method is called even though insertions or multiple
* insertions are disabled in the schema.
*/
static insertMany(docs, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noInserts === true) || (this.schema.noInsertMany === true))
throw new Error('Multiple insertions are disallowed for this model');
const n = docs.length;
const t = new Array(n);
// Apply before insert handler to each document.
for (let i = 0; i < n; i++) {
t[i] = yield this.beforeInsert(docs[i]);
}
log(`${this.schema.model}.insertMany:`, JSON.stringify(t, null, 0));
const collection = yield this.getCollection();
const results = yield collection.insertMany(t, options);
log(`${this.schema.model}.insertMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
const o = results.ops;
const m = o.length;
for (let i = 0; i < m; i++) {
yield this.afterInsert(o[i]);
}
return o;
}
catch (err) {
return null;
}
});
}
/**
* Inserts multiple documents into this model's collection.
*
* @param docs - Array of documents to insert. @see module:mongodb.Collection#insertMany
* @param options - @see module:mongodb.Collection#insertMany
*
* @returns The inserted documents.
*
* @todo This method iterates through every document to apply the beforeInsert
* hook. Consider a more cost-efficient approach?
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#insertMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult}
*
* @throws {Error} This method is called even though insertions or multiple
* insertions are disabled in the schema.
*/
static insertMany(docs, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noInserts === true) || (this.schema.noInsertMany === true))
throw new Error('Multiple insertions are disallowed for this model');
const n = docs.length;
const t = new Array(n);
// Apply before insert handler to each document.
for (let i = 0; i < n; i++) {
t[i] = yield this.beforeInsert(docs[i]);
}
log(`${this.schema.model}.insertMany:`, JSON.stringify(t, null, 0));
const collection = yield this.getCollection();
const results = yield collection.insertMany(t, options);
log(`${this.schema.model}.insertMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
const o = results.ops;
const m = o.length;
for (let i = 0; i < m; i++) {
yield this.afterInsert(o[i]);
}
return o;
});
}
/**
* Updates one document matched by `query` with `update` object. Note that if
* upserting, all *required* fields must be in the `query` param instead of
* the `update` param.
*
* @param query - Query for the document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateOneOptions
*
* @returns The updated doc if `returnDoc` is set to `true`, else there is no
* fulfillment value.
*
* @see {@link https://docs.mongodb.com/manual/reference/operator/update-field/}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#updateOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndUpdate}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult}
*
* @throws {Error} This method is called even though updates are disabled in
* the schema.
* @throws {Error} Query is invalid probably because it is not santized due to
* hooks being skipped.
* @throws {Error} A doc is updated but it cannot be found.
*/
static updateOneStrict(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noUpdates === true)
throw new Error('Updates are disallowed for this model');
const collection = yield this.getCollection();
const [q, u] = (options.skipHooks === true) ? [query, update] : yield this.beforeUpdate(query, update, options);
log(`${this.schema.model}.updateOne:`, JSON.stringify(q, null, 0), JSON.stringify(u, null, 0), JSON.stringify(options, null, 0));
if (options.returnDoc === true) {
if (!is_1.default.plainObject(q)) {
throw new Error('Invalid query, maybe it is not sanitized? This could happen if you enabled skipHooks in the options, in which case you will need to sanitize the query yourself');
});
}
/**
* Updates one document matched by `query` with `update` object. Note that if
* upserting, all *required* fields must be in the `query` param instead of
* the `update` param.
*
* @param query - Query for the document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateOneOptions
*
* @returns The updated doc if `returnDoc` is set to `true`, else there is no
* fulfillment value.
*
* @see {@link https://docs.mongodb.com/manual/reference/operator/update-field/}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#updateOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndUpdate}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult}
*
* @throws {Error} This method is called even though updates are disabled in
* the schema.
* @throws {Error} Query is invalid probably because it is not santized due to
* hooks being skipped.
* @throws {Error} A doc is updated but it cannot be found.
*/
static updateOneStrict(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noUpdates === true)
throw new Error('Updates are disallowed for this model');
const collection = yield this.getCollection();
const [q, u] = (options.skipHooks === true) ? [query, update] : yield this.beforeUpdate(query, update, options);
log(`${this.schema.model}.updateOne:`, JSON.stringify(q, null, 0), JSON.stringify(u, null, 0), JSON.stringify(options, null, 0));
if (options.returnDoc === true) {
if (!is_1.default.plainObject(q)) {
throw new Error('Invalid query, maybe it is not sanitized? This could happen if you enabled skipHooks in the options, in which case you will need to sanitize the query yourself');
}
// Need to keep the original doc for the didUpdateDocument() hook.
const res = yield collection.findOneAndUpdate(q, u, Object.assign({}, options, { returnOriginal: true }));
log(`${this.schema.model}.updateOne results:`, JSON.stringify(res, null, 0), JSON.stringify(options, null, 0));
assert_1.default(res.ok === 1, new Error('Update failed'));
let oldDoc;
let newDoc;
// Handle upserts properly.
if (is_1.default.nullOrUndefined(res.lastErrorObject.upserted)) {
oldDoc = res.value;
if (is_1.default.nullOrUndefined(oldDoc))
throw new Error('Unable to return the old document before the update');
newDoc = yield this.findOne(oldDoc._id);
}
else {
newDoc = yield this.findOne(res.lastErrorObject.upserted);
}
if (is_1.default.nullOrUndefined(newDoc)) {
throw new Error('Unable to find the updated doc');
}
if (options.skipHooks !== true) {
yield this.afterUpdate(oldDoc, newDoc);
}
return newDoc;
}
// Need to keep the original doc for the didUpdateDocument() hook.
const res = yield collection.findOneAndUpdate(q, u, Object.assign({}, options, { returnOriginal: true }));
log(`${this.schema.model}.updateOne results:`, JSON.stringify(res, null, 0), JSON.stringify(options, null, 0));
assert_1.default(res.ok === 1, new Error('Update failed'));
let oldDoc;
let newDoc;
// Handle upserts properly.
if (is_1.default.nullOrUndefined(res.lastErrorObject.upserted)) {
oldDoc = res.value;
if (is_1.default.nullOrUndefined(oldDoc))
throw new Error('Unable to return the old document before the update');
newDoc = yield this.findOne(oldDoc._id);
}
else {
newDoc = yield this.findOne(res.lastErrorObject.upserted);
if (!is_1.default.plainObject(q)) {
throw new Error('Invalid query, maybe it is not sanitized? This could happen if you enabled skipHooks in the options, in which case you will need to sanitize the query yourself');
}
const res = yield collection.updateOne(q, u, options);
log(`${this.schema.model}.updateOne results:`, JSON.stringify(res, null, 0));
assert_1.default(res.result.ok === 1);
if (res.result.n <= 0)
throw new Error('Unable to update the document');
if (options.skipHooks !== true) {
yield this.afterUpdate();
}
}
if (is_1.default.nullOrUndefined(newDoc)) {
throw new Error('Unable to find the updated doc');
});
}
/**
* Same as the strict update one operation except this method swallows all
* errors and returns `null` if no document was updated (and that `returnDoc`
* is `true`) or `true`/`false` (if `returnDoc` is `false`).
*
* @param query - Query for the document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateOneOptions
*
* @returns The updated doc if `returnDoc` is set to `true`, else either
* `true` or `false` depending on whether the operation was
* successful.
*
* @see Model.updateOneStrict
*/
static updateOne(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.updateOneStrict(query, update, options);
if (o && options.returnDoc)
return o;
return true;
}
if (options.skipHooks !== true) {
yield this.afterUpdate(oldDoc, newDoc);
catch (err) {
return options.returnDoc ? null : false;
}
return newDoc;
}
else {
if (!is_1.default.plainObject(q)) {
throw new Error('Invalid query, maybe it is not sanitized? This could happen if you enabled skipHooks in the options, in which case you will need to sanitize the query yourself');
});
}
/**
* Updates multiple documents matched by `query` with `update` object.
*
* @param query - Query for document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateManyOptions
*
* @returns The updated docs if `returnDocs` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see {@link https://docs.mongodb.com/manual/reference/operator/update-field/}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#updateMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndUpdate}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult}
*
* @throws {Error} This method is called even though updates or multiple
* updates are disabled in the schema.
* @throws {Error} One of the updated docs are not returned.
*/
static updateMany(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noUpdates === true) || (this.schema.noUpdateMany === true))
throw new Error('Multiple updates are disallowed for this model');
const [q, u] = yield this.beforeUpdate(query, update, options);
const collection = yield this.getCollection();
log(`${this.schema.model}.updateMany:`, JSON.stringify(q, null, 0), JSON.stringify(u, null, 0), JSON.stringify(options, null, 0));
if (options.returnDocs === true) {
const docs = yield this.findMany(q);
const n = docs.length;
const results = [];
if ((n <= 0) && (options.upsert === true)) {
const res = yield this.updateOne(q, u, Object.assign({}, options, { returnDoc: true, skipHooks: true }));
if (is_1.default.boolean(res) || is_1.default.nullOrUndefined(res)) {
throw new Error('Error upserting document during an updateMany operation');
}
results.push(res);
}
else {
for (let i = 0; i < n; i++) {
const doc = docs[i];
const result = yield collection.findOneAndUpdate({ _id: doc._id }, u, Object.assign({ returnOriginal: false }, options));
assert_1.default(result.ok === 1);
assert_1.default(result.value);
results.push(result.value);
}
log(`${this.schema.model}.updateMany results:`, JSON.stringify(results, null, 0));
}
yield this.afterUpdate(undefined, results);
return results;
}
const res = yield collection.updateOne(q, u, options);
log(`${this.schema.model}.updateOne results:`, JSON.stringify(res, null, 0));
assert_1.default(res.result.ok === 1);
if (res.result.n <= 0)
throw new Error('Unable to update the document');
if (options.skipHooks !== true) {
else {
const results = yield collection.updateMany(q, u, options);
log(`${this.schema.model}.updateMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
if (results.result.n <= 0)
return false;
yield this.afterUpdate();
return true;
}
}
});
}
/**
* Same as the strict update one operation except this method swallows all
* errors and returns `null` if no document was updated (and that `returnDoc`
* is `true`) or `true`/`false` (if `returnDoc` is `false`).
*
* @param query - Query for the document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateOneOptions
*
* @returns The updated doc if `returnDoc` is set to `true`, else either
* `true` or `false` depending on whether the operation was
* successful.
*
* @see Model.updateOneStrict
*/
static updateOne(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.updateOneStrict(query, update, options);
if (o && options.returnDoc)
return o;
return true;
}
catch (err) {
return options.returnDoc ? null : false;
}
});
}
/**
* Updates multiple documents matched by `query` with `update` object.
*
* @param query - Query for document to update.
* @param update - Either an object whose key/value pair represent the fields
* belonging to this model to update to, or an update query.
* @param options - @see ModelUpdateManyOptions
*
* @returns The updated docs if `returnDocs` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see {@link https://docs.mongodb.com/manual/reference/operator/update-field/}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#updateMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndUpdate}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult}
*
* @throws {Error} This method is called even though updates or multiple
* updates are disabled in the schema.
* @throws {Error} One of the updated docs are not returned.
*/
static updateMany(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noUpdates === true) || (this.schema.noUpdateMany === true))
throw new Error('Multiple updates are disallowed for this model');
const [q, u] = yield this.beforeUpdate(query, update, options);
const collection = yield this.getCollection();
log(`${this.schema.model}.updateMany:`, JSON.stringify(q, null, 0), JSON.stringify(u, null, 0), JSON.stringify(options, null, 0));
if (options.returnDocs === true) {
const docs = yield this.findMany(q);
const n = docs.length;
const results = [];
if ((n <= 0) && (options.upsert === true)) {
const res = yield this.updateOne(q, u, Object.assign({}, options, { returnDoc: true, skipHooks: true }));
if (is_1.default.boolean(res) || is_1.default.nullOrUndefined(res)) {
throw new Error('Error upserting document during an updateMany operation');
});
}
/**
* Deletes one document matched by `query`.
*
* @param query - Query for document to delete.
* @param options @see ModelDeleteOneOptions
*
* @returns The deleted doc if `returnDoc` is set to `true`.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#deleteOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndDelete}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult}
*
* @throws {Error} This method is called even though deletions are disabled in
* the schema.
* @throws {Error} Unable to return the deleted document when `returnDoc` is
* `true`.
* @throws {Error} Unable to delete document.
*/
static deleteOneStrict(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noDeletes === true)
throw new Error('Deletions are disallowed for this model');
const q = yield this.beforeDelete(query, options);
log(`${this.schema.model}.deleteOne:`, JSON.stringify(query, null, 0));
const collection = yield this.getCollection();
if (options.returnDoc === true) {
const results = yield collection.findOneAndDelete(q);
log(`${this.schema.model}.deleteOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.ok === 1);
if (!results.value)
throw new Error('Unable to return deleted document');
yield this.afterDelete(results.value);
return results.value;
}
else {
const results = yield collection.deleteOne(q, options);
log(`${this.schema.model}.deleteOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1, new Error('Unable to delete document'));
if (!is_1.default.number(results.result.n) || (results.result.n <= 0))
throw new Error('Unable to delete document');
yield this.afterDelete();
}
});
}
/**
* Same as the strict delete one operation except this method swallows all
* errors.
*
* @param query - Query for document to delete.
* @param options @see ModelDeleteOneOptions
*
* @returns The deleted doc if `returnDoc` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see Model.deleteOneStrict
*/
static deleteOne(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.deleteOneStrict(query, options);
if (options.returnDoc && o) {
return o;
}
results.push(res);
else {
return true;
}
}
else {
catch (err) {
return options.returnDoc ? null : false;
}
});
}
/**
* Deletes multiple documents matched by `query`.
*
* @param query - Query to match documents for deletion.
* @param options - @see ModelDeleteManyOptions
*
* @returns The deleted docs if `returnDocs` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#deleteMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndDelete}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult}
*
* @throws {Error} This method is called even though deletions or multiple
* deletions are disabled in the schema.
*/
static deleteMany(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noDeletes === true) || (this.schema.noDeleteMany === true))
throw new Error('Multiple deletions are disallowed for this model');
const q = yield this.beforeDelete(query, options);
log(`${this.schema.model}.deleteMany:`, JSON.stringify(q, null, 0));
const collection = yield this.getCollection();
if (options.returnDocs === true) {
const docs = yield this.findMany(q);
const n = docs.length;
const results = [];
for (let i = 0; i < n; i++) {
const doc = docs[i];
const result = yield collection.findOneAndUpdate({ _id: doc._id }, u, Object.assign({ returnOriginal: false }, options));
const result = yield collection.findOneAndDelete({ _id: doc._id });
assert_1.default(result.ok === 1);
assert_1.default(result.value);
results.push(result.value);
if (result.value) {
results.push(result.value);
}
}
log(`${this.schema.model}.updateMany results:`, JSON.stringify(results, null, 0));
log(`${this.schema.model}.deleteMany results:`, JSON.stringify(results, null, 0));
const m = results.length;
yield this.afterDelete(results);
return results;
}
yield this.afterUpdate(undefined, results);
return results;
}
else {
const results = yield collection.updateMany(q, u, options);
log(`${this.schema.model}.updateMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
if (results.result.n <= 0)
return false;
yield this.afterUpdate();
return true;
}
});
}
/**
* Deletes one document matched by `query`.
*
* @param query - Query for document to delete.
* @param options @see ModelDeleteOneOptions
*
* @returns The deleted doc if `returnDoc` is set to `true`.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#deleteOne}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndDelete}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult}
*
* @throws {Error} This method is called even though deletions are disabled in
* the schema.
* @throws {Error} Unable to return the deleted document when `returnDoc` is
* `true`.
* @throws {Error} Unable to delete document.
*/
static deleteOneStrict(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (this.schema.noDeletes === true)
throw new Error('Deletions are disallowed for this model');
const q = yield this.beforeDelete(query, options);
log(`${this.schema.model}.deleteOne:`, JSON.stringify(query, null, 0));
const collection = yield this.getCollection();
if (options.returnDoc === true) {
const results = yield collection.findOneAndDelete(q);
log(`${this.schema.model}.deleteOne results:`, JSON.stringify(results, null, 0));
else {
const results = yield collection.deleteMany(q, Object.assign({}, options));
log(`${this.schema.model}.deleteMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
if (!is_1.default.number(results.result.n) || (results.result.n <= 0))
return false;
yield this.afterDelete();
return true;
}
});
}
/**
* Replaces one document with another. If `replacement` is not specified,
* one with random info will be generated.
*
* @param query - Query for document to replace.
* @param replacement - The replacement document.
* @param options - @see ModelReplaceOneOptions
*
* @returns The replaced document (by default) or the new document (depending
* on the `returnOriginal` option).
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndReplace}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult}
*
* @throws {Error} The old document cannot be returned.
* @throws {Error} The doc is replaced but it cannot be fetched.
*/
static findAndReplaceOneStrict(query, replacement, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const q = yield this.beforeDelete(query, options);
const r = yield this.beforeInsert(replacement || (yield this.randomFields()), options);
log(`${this.schema.model}.replaceOne:`, JSON.stringify(q, null, 0), JSON.stringify(r, null, 0));
const collection = yield this.getCollection();
const results = yield collection.findOneAndReplace(q, r, Object.assign({}, options, { returnOriginal: true }));
log(`${this.schema.model}.replaceOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.ok === 1);
if (!results.value)
throw new Error('Unable to return deleted document');
const oldDoc = results.value;
if (is_1.default.nullOrUndefined(oldDoc))
throw new Error('Unable to return the old document');
const newDoc = yield this.findOne(r);
if (is_1.default.null_(newDoc)) {
throw new Error('Document is replaced but unable to find the new document in the database');
}
yield this.afterDelete(results.value);
return results.value;
}
else {
const results = yield collection.deleteOne(q, options);
log(`${this.schema.model}.deleteOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1, new Error('Unable to delete document'));
if (!is_1.default.number(results.result.n) || (results.result.n <= 0))
throw new Error('Unable to delete document');
yield this.afterDelete();
}
});
}
/**
* Same as the strict delete one operation except this method swallows all
* errors.
*
* @param query - Query for document to delete.
* @param options @see ModelDeleteOneOptions
*
* @returns The deleted doc if `returnDoc` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see Model.deleteOneStrict
*/
static deleteOne(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.deleteOneStrict(query, options);
if (options.returnDoc && o) {
yield this.afterInsert(newDoc);
return (options.returnOriginal === true) ? oldDoc : newDoc;
});
}
/**
* Same as the strict find and replace one operation except this method
* swallows all errors.
*
* @param query - Query for document to replace.
* @param replacement - The replacement document.
* @param options - @see ModelReplaceOneOptions
*
* @returns The replaced document (by default) or the new document (depending
* on the `returnOriginal` option) if available, `null` otherwise.
*
* @see Model.findAndReplaceOneStrict
*/
static findAndReplaceOne(query, replacement, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.findAndReplaceOneStrict(query, replacement, options);
return o;
}
else {
return true;
catch (err) {
return null;
}
}
catch (err) {
return options.returnDoc ? null : false;
}
});
}
/**
* Deletes multiple documents matched by `query`.
*
* @param query - Query to match documents for deletion.
* @param options - @see ModelDeleteManyOptions
*
* @returns The deleted docs if `returnDocs` is set to `true`, else `true` or
* `false` depending on whether or not the operation was successful.
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#deleteMany}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndDelete}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult}
*
* @throws {Error} This method is called even though deletions or multiple
* deletions are disabled in the schema.
*/
static deleteMany(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((this.schema.noDeletes === true) || (this.schema.noDeleteMany === true))
throw new Error('Multiple deletions are disallowed for this model');
const q = yield this.beforeDelete(query, options);
log(`${this.schema.model}.deleteMany:`, JSON.stringify(q, null, 0));
const collection = yield this.getCollection();
if (options.returnDocs === true) {
const docs = yield this.findMany(q);
const n = docs.length;
const results = [];
for (let i = 0; i < n; i++) {
const doc = docs[i];
const result = yield collection.findOneAndDelete({ _id: doc._id });
assert_1.default(result.ok === 1);
if (result.value) {
results.push(result.value);
});
}
/**
* Checks if a document exists.
*
* @param query - Query for document to check.
*
* @returns `true` if document exists, `false` otherwise.
*/
static exists(query) {
return __awaiter(this, void 0, void 0, function* () {
const id = yield this.identifyOne(query);
return id ? true : false;
});
}
/**
* Counts the documents that match the provided query.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The total number of documents found. The minimum is 0.
*/
static count(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const results = yield this.findMany(query, options);
return results.length;
});
}
/**
* Returns a document whose values are formatted according to the format
* function sdefined in the schema. If the field is marked as encrypted in the
* schema, this process takes care of that too.
*
* @param doc - Document to format.
*
* @returns The formatted document as the fulfillment value.
*/
static formatDocument(doc) {
return __awaiter(this, void 0, void 0, function* () {
const formattedDoc = lodash_1.default.cloneDeep(doc);
const fields = this.schema.fields;
for (const key in this.schema.fields) {
if (!formattedDoc.hasOwnProperty(key))
continue;
const fieldSpecs = fields[key];
assert_1.default(fieldSpecs, new Error(`Field ${key} not found in schema`));
// If the schema has a certain formatting function defined for this field,
// apply it.
if (is_1.default.function_(fieldSpecs.format)) {
const formattedValue = yield fieldSpecs.format(formattedDoc[key]);
formattedDoc[key] = formattedValue;
}
// If the schema indicates that this field is encrypted, encrypt it.
if (fieldSpecs.encrypted === true) {
formattedDoc[key] = (yield bcrypt_1.default.hash(`${formattedDoc[key]}`, 10));
}
}
log(`${this.schema.model}.deleteMany results:`, JSON.stringify(results, null, 0));
const m = results.length;
yield this.afterDelete(results);
return results;
}
else {
const results = yield collection.deleteMany(q, Object.assign({}, options));
log(`${this.schema.model}.deleteMany results:`, JSON.stringify(results, null, 0));
assert_1.default(results.result.ok === 1);
if (!is_1.default.number(results.result.n) || (results.result.n <= 0))
return false;
yield this.afterDelete();
return true;
}
});
}
/**
* Replaces one document with another. If `replacement` is not specified,
* one with random info will be generated.
*
* @param query - Query for document to replace.
* @param replacement - The replacement document.
* @param options - @see ModelReplaceOneOptions
*
* @returns The replaced document (by default) or the new document (depending
* on the `returnOriginal` option).
*
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#findOneAndReplace}
* @see {@link http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult}
*
* @throws {Error} The old document cannot be returned.
* @throws {Error} The doc is replaced but it cannot be fetched.
*/
static findAndReplaceOneStrict(query, replacement, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const q = yield this.beforeDelete(query, options);
const r = yield this.beforeInsert(replacement || (yield this.randomFields()), options);
log(`${this.schema.model}.replaceOne:`, JSON.stringify(q, null, 0), JSON.stringify(r, null, 0));
const collection = yield this.getCollection();
const results = yield collection.findOneAndReplace(q, r, Object.assign({}, options, { returnOriginal: true }));
log(`${this.schema.model}.replaceOne results:`, JSON.stringify(results, null, 0));
assert_1.default(results.ok === 1);
const oldDoc = results.value;
if (is_1.default.nullOrUndefined(oldDoc))
throw new Error('Unable to return the old document');
const newDoc = yield this.findOne(r);
if (is_1.default.null_(newDoc)) {
throw new Error('Document is replaced but unable to find the new document in the database');
}
yield this.afterDelete(results.value);
yield this.afterInsert(newDoc);
return (options.returnOriginal === true) ? oldDoc : newDoc;
});
}
/**
* Same as the strict find and replace one operation except this method
* swallows all errors.
*
* @param query - Query for document to replace.
* @param replacement - The replacement document.
* @param options - @see ModelReplaceOneOptions
*
* @returns The replaced document (by default) or the new document (depending
* on the `returnOriginal` option) if available, `null` otherwise.
*
* @see Model.findAndReplaceOneStrict
*/
static findAndReplaceOne(query, replacement, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
try {
const o = yield this.findAndReplaceOneStrict(query, replacement, options);
return o;
}
catch (err) {
return null;
}
});
}
/**
* Checks if a document exists.
*
* @param query - Query for document to check.
*
* @returns `true` if document exists, `false` otherwise.
*/
static exists(query) {
return __awaiter(this, void 0, void 0, function* () {
const id = yield this.identifyOne(query);
return id ? true : false;
});
}
/**
* Counts the documents that match the provided query.
*
* @param query - Query used for the $match stage of the aggregation pipeline.
*
* @returns The total number of documents found. The minimum is 0.
*/
static count(query, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const results = yield this.findMany(query, options);
return results.length;
});
}
/**
* Returns a document whose values are formatted according to the format
* function sdefined in the schema. If the field is marked as encrypted in the
* schema, this process takes care of that too.
*
* @param doc - Document to format.
*
* @returns The formatted document as the fulfillment value.
*/
static formatDocument(doc) {
return __awaiter(this, void 0, void 0, function* () {
const formattedDoc = lodash_1.default.cloneDeep(doc);
const fields = this.schema.fields;
for (const key in this.schema.fields) {
if (!formattedDoc.hasOwnProperty(key))
continue;
const fieldSpecs = fields[key];
assert_1.default(fieldSpecs, new Error(`Field ${key} not found in schema`));
// If the schema has a certain formatting function defined for this field,
// apply it.
if (is_1.default.function_(fieldSpecs.format)) {
const formattedValue = yield fieldSpecs.format(formattedDoc[key]);
formattedDoc[key] = formattedValue;
}
// If the schema indicates that this field is encrypted, encrypt it.
if (fieldSpecs.encrypted === true) {
formattedDoc[key] = (yield bcrypt_1.default.hash(`${formattedDoc[key]}`, 10));
}
}
return formattedDoc;
});
}
/**
* Validates a document for this collection. It checks for the following in
* order:
* 1. Each field is defined in the schema.
* 2. Each field value conforms to the defined field specs.
* 3. Unique indexes are enforced (only if `ignoreUniqueIndex` is enabled).
* 4. No required fields are missing (only if `strict` is enabled).
*
* @param doc - The doc to validate.
* @param options - @see ModelValidateDocumentOptions
*
* @returns `true` will be fulfilled if all tests have passed.
*
* @throws {Error} Document is not an object.
* @throws {Error} Document is empty.
* @throws {Error} One of the fields in the document is not defined in the
* schema.
* @throws {Error} One of the fields in the document does not pass the
* validation test.
* @throws {Error} One of the fields has a duplicated value as another
* document in the collection (only if unique indexes are
* defined in the schema).
* @throws {Error} Some required fields in the document are missing.
*/
static validateDocument(doc, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (!is_1.default.plainObject(doc))
throw new Error('Invalid document provided');
if (is_1.default.emptyObject(doc))
throw new Error('Empty objects are not permitted');
const fields = this.schema.fields;
for (const key in doc) {
// Skip validation for fields `_id`, `updatedAt` and `createdAt` since
// they are automatically generated.
if (key === '_id')
continue;
if (this.schema.timestamps && (key === 'updatedAt'))
continue;
if (this.schema.timestamps && (key === 'createdAt'))
continue;
const val = doc[key];
// #1 Check if field is defined in the schema.
if (!this.schema.fields.hasOwnProperty(key)) {
throw new Error(`The field '${key}' is not defined in the schema`);
}
// #2 Check if field value conforms to its defined specs.
const fieldSpecs = fields[key];
validateFieldValue_1.default(val, fieldSpecs);
}
// #3 Check for unique fields only if `ignoreUniqueIndex` is not `true`.
if ((options.ignoreUniqueIndex !== true) && this.schema.indexes) {
const n = this.schema.indexes.length;
for (let i = 0; i < n; i++) {
const index = this.schema.indexes[i];
if (!index.options)
return formattedDoc;
});
}
/**
* Validates a document for this collection. It checks for the following in
* order:
* 1. Each field is defined in the schema.
* 2. Each field value conforms to the defined field specs.
* 3. Unique indexes are enforced (only if `ignoreUniqueIndex` is enabled).
* 4. No required fields are missing (only if `strict` is enabled).
*
* @param doc - The doc to validate.
* @param options - @see ModelValidateDocumentOptions
*
* @returns `true` will be fulfilled if all tests have passed.
*
* @throws {Error} Document is not an object.
* @throws {Error} Document is empty.
* @throws {Error} One of the fields in the document is not defined in the
* schema.
* @throws {Error} One of the fields in the document does not pass the
* validation test.
* @throws {Error} One of the fields has a duplicated value as another
* document in the collection (only if unique indexes are
* defined in the schema).
* @throws {Error} Some required fields in the document are missing.
*/
static validateDocument(doc, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if (!is_1.default.plainObject(doc))
throw new Error('Invalid document provided');
if (is_1.default.emptyObject(doc))
throw new Error('Empty objects are not permitted');
const fields = this.schema.fields;
for (const key in doc) {
// Skip validation for fields `_id`, `updatedAt` and `createdAt` since
// they are automatically generated.
if (key === '_id')
continue;
if (!index.options.unique)
if (this.schema.timestamps && (key === 'updatedAt'))
continue;
if (!index.spec)
if (this.schema.timestamps && (key === 'createdAt'))
continue;
if (!Object.keys(index.spec).every(v => Object.keys(doc).indexOf(v) > -1))
continue;
const uniqueQuery = lodash_1.default.pick(doc, Object.keys(index.spec));
if (yield this.findOne(uniqueQuery))
throw new Error(`Another document already exists with ${JSON.stringify(uniqueQuery, null, 0)}`);
const val = doc[key];
// #1 Check if field is defined in the schema.
if (!this.schema.fields.hasOwnProperty(key)) {
throw new Error(`The field '${key}' is not defined in the schema`);
}
// #2 Check if field value conforms to its defined specs.
const fieldSpecs = fields[key];
validateFieldValue_1.default(val, fieldSpecs);
}
}
// #4 Check for required fields if `strict` is `true`.
if (options.strict === true) {
// #3 Check for unique fields only if `ignoreUniqueIndex` is not `true`.
if ((options.ignoreUniqueIndex !== true) && this.schema.indexes) {
const n = this.schema.indexes.length;
for (let i = 0; i < n; i++) {
const index = this.schema.indexes[i];
if (!index.options)
continue;
if (!index.options.unique)
continue;
if (!index.spec)
continue;
if (!Object.keys(index.spec).every(v => Object.keys(doc).indexOf(v) > -1))
continue;
const uniqueQuery = lodash_1.default.pick(doc, Object.keys(index.spec));
if (yield this.findOne(uniqueQuery))
throw new Error(`Another document already exists with ${JSON.stringify(uniqueQuery, null, 0)}`);
}
}
// #4 Check for required fields if `strict` is `true`.
if (options.strict === true) {
for (const key in this.schema.fields) {
if (!this.schema.fields.hasOwnProperty(key))
continue;
const field = fields[key];
if (!field.required || field.default)
continue;
if (!doc.hasOwnProperty(key))
throw new Error(`Missing required field '${key}'`);
}
}
return true;
});
}
/**
* Handler called before an attempt to insert document into the database. This
* is a good place to apply any custom pre-processing to the document before
* it is inserted into the document. This method must return the document to
* be inserted.
*
* @param doc - The document to be inserted.
* @param options - Additional options.
*
* @returns The document to be inserted.
*/
static willInsertDocument(doc) {
return __awaiter(this, void 0, void 0, function* () {
return doc;
});
}
/**
* Handler called after the document is successfully inserted.
*
* @param doc - The inserted document.
*/
static didInsertDocument(doc) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Handler called before an attempted update operation. This method must
* return the query and update descriptor for the update operation.
*
* @param query - The query for document(s) to update.
* @param update - The update descriptor.
*
* @returns A tuple of the query and the update descriptor.
*/
static willUpdateDocument(query, update) {
return __awaiter(this, void 0, void 0, function* () {
return [query, update];
});
}
/**
* Handler called after a document or a set of documents have been
* successfully updated.
*
* @param prevDoc - The document before it is updated. This is only available
* if `returnDoc` was enabled, and only for updateOne().
* @param newDocs - The updated document(s). This is only available if
* `returnDoc` or `returnDocs` was enabled.
*/
static didUpdateDocument(prevDoc, newDocs) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Handler called before an attempt to delete a document.
*
* @param query - The query for the document to be deleted.
*
* @returns The document to be deleted.
*/
static willDeleteDocument(query) {
return __awaiter(this, void 0, void 0, function* () {
return query;
});
}
/**
* Handler called after a document or a set of documents are successfully
* deleted.
*
* @param docs - The deleted document(s) if available.
*/
static didDeleteDocument(docs) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Processes a document before it is inserted. This is also used during an
* upsert operation.
*
* @param doc - The document to be inserted/upserted.
* @param options - @see ModelBeforeInsertOptions
*
* @returns Document to be inserted/upserted to the database.
*/
static beforeInsert(doc, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const fields = this.schema.fields;
// Call event hook first.
const d = yield this.willInsertDocument(doc);
let o = sanitizeDocument_1.default(this.schema, d);
// Unless specified, always renew the `createdAt` and `updatedAt` fields.
if ((this.schema.timestamps === true) && (options.ignoreTimestamps !== true)) {
if (!is_1.default.date(o.createdAt))
o.createdAt = new Date();
if (!is_1.default.date(o.updatedAt))
o.updatedAt = new Date();
}
// Before inserting this document, go through each field and make sure that
// it has default values and that they are formatted correctly.
for (const key in this.schema.fields) {
if (!this.schema.fields.hasOwnProperty(key))
continue;
const field = fields[key];
if (!field.required || field.default)
if (o.hasOwnProperty(key))
continue;
if (!doc.hasOwnProperty(key))
throw new Error(`Missing required field '${key}'`);
const fieldSpecs = fields[key];
// Check if the field has a default value defined in the schema. If so,
// apply it.
if (is_1.default.undefined(fieldSpecs.default))
continue;
o[key] = (is_1.default.function_(fieldSpecs.default)) ? fieldSpecs.default() : fieldSpecs.default;
}
}
return true;
});
}
/**
* Handler called before an attempt to insert document into the database. This
* is a good place to apply any custom pre-processing to the document before
* it is inserted into the document. This method must return the document to
* be inserted.
*
* @param doc - The document to be inserted.
* @param options - Additional options.
*
* @returns The document to be inserted.
*/
static willInsertDocument(doc) {
return __awaiter(this, void 0, void 0, function* () {
return doc;
});
}
/**
* Handler called after the document is successfully inserted.
*
* @param doc - The inserted document.
*/
static didInsertDocument(doc) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Handler called before an attempted update operation. This method must
* return the query and update descriptor for the update operation.
*
* @param query - The query for document(s) to update.
* @param update - The update descriptor.
*
* @returns A tuple of the query and the update descriptor.
*/
static willUpdateDocument(query, update) {
return __awaiter(this, void 0, void 0, function* () {
return [query, update];
});
}
/**
* Handler called after a document or a set of documents have been
* successfully updated.
*
* @param prevDoc - The document before it is updated. This is only available
* if `returnDoc` was enabled, and only for updateOne().
* @param newDocs - The updated document(s). This is only available if
* `returnDoc` or `returnDocs` was enabled.
*/
static didUpdateDocument(prevDoc, newDocs) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Handler called before an attempt to delete a document.
*
* @param query - The query for the document to be deleted.
*
* @returns The document to be deleted.
*/
static willDeleteDocument(query) {
return __awaiter(this, void 0, void 0, function* () {
return query;
});
}
/**
* Handler called after a document or a set of documents are successfully
* deleted.
*
* @param docs - The deleted document(s) if available.
*/
static didDeleteDocument(docs) {
return __awaiter(this, void 0, void 0, function* () { });
}
/**
* Processes a document before it is inserted. This is also used during an
* upsert operation.
*
* @param doc - The document to be inserted/upserted.
* @param options - @see ModelBeforeInsertOptions
*
* @returns Document to be inserted/upserted to the database.
*/
static beforeInsert(doc, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const fields = this.schema.fields;
// Call event hook first.
const d = yield this.willInsertDocument(doc);
let o = sanitizeDocument_1.default(this.schema, d);
// Unless specified, always renew the `createdAt` and `updatedAt` fields.
if ((this.schema.timestamps === true) && (options.ignoreTimestamps !== true)) {
if (!is_1.default.date(o.createdAt))
o.createdAt = new Date();
if (!is_1.default.date(o.updatedAt))
o.updatedAt = new Date();
}
// Before inserting this document, go through each field and make sure that
// it has default values and that they are formatted correctly.
for (const key in this.schema.fields) {
if (!this.schema.fields.hasOwnProperty(key))
continue;
if (o.hasOwnProperty(key))
continue;
const fieldSpecs = fields[key];
// Check if the field has a default value defined in the schema. If so,
// apply it.
if (is_1.default.undefined(fieldSpecs.default))
continue;
o[key] = (is_1.default.function_(fieldSpecs.default)) ? fieldSpecs.default() : fieldSpecs.default;
}
// Apply format function defined in the schema if applicable.
o = yield this.formatDocument(o);
// Finally, validate the document as a final sanity check.
yield this.validateDocument(o, Object.assign({ ignoreUniqueIndex: true, strict: true }, options));
return o;
});
}
/**
* Handler invoked right after a document insertion.
*
* @param doc - The inserted document.
*/
static afterInsert(doc) {
return __awaiter(this, void 0, void 0, function* () {
yield this.didInsertDocument(doc);
});
}
/**
* Handler invoked right before an update. This is NOT invoked on an
* insertion.
*
* @param query - Query for document to update.
* @param update - The update to apply.
* @param options - @see ModelUpdateOneOptions, @see ModelUpdateManyOptions
*
* @returns The modified update to apply.
*
* @throws {Error} Attempting to upsert even though upserts are disabled in
* the schema.
*/
static beforeUpdate(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((options.upsert === true) && (this.schema.allowUpserts !== true))
throw new Error('Attempting to upsert a document while upserting is disallowed in the schema');
const [q, u] = yield this.willUpdateDocument(query, update);
// First sanitize the inputs. We want to be able to make sure the query is
// valid and that the update object is a proper update query.
const sanitizedQuery = sanitizeQuery_1.default(this.schema, q);
const sanitizedUpdate = types_1.typeIsUpdateQuery(u) ? Object.assign({}, u) : { $set: u };
// Sanitize all update queries. Remap `null` values to `$unset`.
if (sanitizedUpdate.$set) {
const obj = sanitizedUpdate.$set;
const nulls = Object.keys(obj).filter(v => (obj[v] === null));
const n = nulls.length;
sanitizedUpdate.$set = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$set);
if (n > 0) {
sanitizedUpdate.$unset = {};
for (let i = 0; i < n; i++) {
sanitizedUpdate.$unset[nulls[i]] = '';
// Apply format function defined in the schema if applicable.
o = yield this.formatDocument(o);
// Finally, validate the document as a final sanity check.
yield this.validateDocument(o, Object.assign({ ignoreUniqueIndex: true, strict: true }, options));
return o;
});
}
/**
* Handler invoked right after a document insertion.
*
* @param doc - The inserted document.
*/
static afterInsert(doc) {
return __awaiter(this, void 0, void 0, function* () {
yield this.didInsertDocument(doc);
});
}
/**
* Handler invoked right before an update. This is NOT invoked on an
* insertion.
*
* @param query - Query for document to update.
* @param update - The update to apply.
* @param options - @see ModelUpdateOneOptions, @see ModelUpdateManyOptions
*
* @returns The modified update to apply.
*
* @throws {Error} Attempting to upsert even though upserts are disabled in
* the schema.
*/
static beforeUpdate(query, update, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
if ((options.upsert === true) && (this.schema.allowUpserts !== true))
throw new Error('Attempting to upsert a document while upserting is disallowed in the schema');
const [q, u] = yield this.willUpdateDocument(query, update);
// First sanitize the inputs. We want to be able to make sure the query is
// valid and that the update object is a proper update query.
const sanitizedQuery = sanitizeQuery_1.default(this.schema, q);
const sanitizedUpdate = types_1.typeIsUpdateQuery(u) ? Object.assign({}, u) : { $set: u };
// Sanitize all update queries. Remap `null` values to `$unset`.
if (sanitizedUpdate.$set) {
const obj = sanitizedUpdate.$set;
const nulls = Object.keys(obj).filter(v => (obj[v] === null));
const n = nulls.length;
sanitizedUpdate.$set = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$set);
if (n > 0) {
sanitizedUpdate.$unset = {};
for (let i = 0; i < n; i++) {
sanitizedUpdate.$unset[nulls[i]] = '';
}
}
}
}
if (sanitizedUpdate.$setOnInsert)
sanitizedUpdate.$setOnInsert = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$setOnInsert);
if (sanitizedUpdate.$addToSet)
sanitizedUpdate.$addToSet = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$addToSet);
if (sanitizedUpdate.$push)
sanitizedUpdate.$push = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$push);
// Add updated timestamps if applicable.
if ((this.schema.timestamps === true) && (options.ignoreTimestamps !== true)) {
if (!sanitizedUpdate.$set)
sanitizedUpdate.$set = {};
if (!is_1.default.date(sanitizedUpdate.$set.updatedAt))
sanitizedUpdate.$set.updatedAt = new Date();
}
// Format all fields in the update query.
if (sanitizedUpdate.$set) {
sanitizedUpdate.$set = yield this.formatDocument(sanitizedUpdate.$set);
}
// In the case of an upsert, we need to preprocess the query as if this was
// an insertion. We also need to tell the database to save all fields in the
// query to the database as well, unless they are already in the update
// query.
if (options.upsert === true) {
// Make a copy of the query in case it is manipulated by the hooks.
const beforeInsert = yield this.beforeInsert(lodash_1.default.cloneDeep(sanitizedQuery), Object.assign({}, options, { strict: false }));
const setOnInsert = lodash_1.default.omit(Object.assign({}, sanitizedUpdate.$setOnInsert || {}, beforeInsert), [
...Object.keys(sanitizedUpdate.$set || {}),
...Object.keys(sanitizedUpdate.$unset || {}),
]);
if (!is_1.default.emptyObject(setOnInsert)) {
sanitizedUpdate.$setOnInsert = setOnInsert;
if (sanitizedUpdate.$setOnInsert)
sanitizedUpdate.$setOnInsert = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$setOnInsert);
if (sanitizedUpdate.$addToSet)
sanitizedUpdate.$addToSet = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$addToSet);
if (sanitizedUpdate.$push)
sanitizedUpdate.$push = sanitizeDocument_1.default(this.schema, sanitizedUpdate.$push);
// Add updated timestamps if applicable.
if ((this.schema.timestamps === true) && (options.ignoreTimestamps !== true)) {
if (!sanitizedUpdate.$set)
sanitizedUpdate.$set = {};
if (!is_1.default.date(sanitizedUpdate.$set.updatedAt))
sanitizedUpdate.$set.updatedAt = new Date();
}
}
// Validate all fields in the update query.
if (sanitizedUpdate.$set && !is_1.default.emptyObject(sanitizedUpdate.$set)) {
yield this.validateDocument(sanitizedUpdate.$set, Object.assign({ ignoreUniqueIndex: true }, options));
}
// Strip empty objects.
const { $set, $setOnInsert, $addToSet, $push } = sanitizedUpdate, rest = __rest(sanitizedUpdate, ["$set", "$setOnInsert", "$addToSet", "$push"]);
const finalizedUpdate = Object.assign({}, rest, (is_1.default.nullOrUndefined($set) || is_1.default.emptyObject($set)) ? {} : { $set }, (is_1.default.nullOrUndefined($setOnInsert) || is_1.default.emptyObject($setOnInsert)) ? {} : { $setOnInsert }, (is_1.default.nullOrUndefined($addToSet) || is_1.default.emptyObject($addToSet)) ? {} : { $addToSet }, (is_1.default.nullOrUndefined($push) || is_1.default.emptyObject($push)) ? {} : { $push });
return [sanitizedQuery, finalizedUpdate];
});
}
/**
* Handler invoked right after an update. This does not account for
* insertions.
*
* @param oldDoc - The original document.
* @param newDoc - The updated document.
*/
static afterUpdate(oldDoc, newDocs) {
return __awaiter(this, void 0, void 0, function* () {
yield this.didUpdateDocument(oldDoc, newDocs);
});
}
/**
* Handler invoked right before a deletion.
*
* @param query - Query for document to delete.
* @param options - @see ModelDeleteOneOptions, @see ModelDeleteManyOptions
*/
static beforeDelete(query, options) {
return __awaiter(this, void 0, void 0, function* () {
const q = yield this.willDeleteDocument(query);
return sanitizeQuery_1.default(this.schema, q);
});
}
/**
* Handler invoked right after a deletion.
*
* @param doc - The deleted doc, if available.
*
* @todo Cascade deletion only works for first-level foreign keys so far.
*/
static afterDelete(docs) {
return __awaiter(this, void 0, void 0, function* () {
if (is_1.default.array(docs)) {
for (const doc of docs) {
if (!types_1.typeIsValidObjectID(doc._id))
continue;
yield this.cascadeDelete(doc._id);
// Format all fields in the update query.
if (sanitizedUpdate.$set) {
sanitizedUpdate.$set = yield this.formatDocument(sanitizedUpdate.$set);
}
}
else if (!is_1.default.nullOrUndefined(docs) && types_1.typeIsValidObjectID(docs._id)) {
yield this.cascadeDelete(docs._id);
}
yield this.didDeleteDocument(docs);
});
}
/**
* Deletes documents from other collections that have a foreign key to this
* collection, as specified in the schema.
*
* @param docId - The ID of the document in this collection in which other
* collections are pointing to.
*
* @throws {Error} Cascade deletion is incorrectly defined in the schema.
*/
static cascadeDelete(docId) {
return __awaiter(this, void 0, void 0, function* () {
const cascadeModelNames = this.schema.cascade;
if (is_1.default.nullOrUndefined(cascadeModelNames))
return;
if (!is_1.default.array(cascadeModelNames))
throw new Error('Invalid definition of cascade in schema');
for (const modelName of cascadeModelNames) {
const ModelClass = __1.getModel(modelName);
const fields = ModelClass.schema.fields;
assert_1.default(ModelClass, `Trying to cascade delete from model ${modelName} but model is not found`);
for (const key in ModelClass.schema.fields) {
if (!ModelClass.schema.fields.hasOwnProperty(key))
continue;
const field = fields[key];
if (field.ref === this.schema.model) {
log(`Cascade deleting all ${modelName} documents whose "${key}" field is ${docId}`);
yield ModelClass.deleteMany({ [`${key}`]: docId });
// In the case of an upsert, we need to preprocess the query as if this was
// an insertion. We also need to tell the database to save all fields in the
// query to the database as well, unless they are already in the update
// query.
if (options.upsert === true) {
// Make a copy of the query in case it is manipulated by the hooks.
const beforeInsert = yield this.beforeInsert(lodash_1.default.cloneDeep(sanitizedQuery), Object.assign({}, options, { strict: false }));
const setOnInsert = lodash_1.default.omit(Object.assign({}, sanitizedUpdate.$setOnInsert || {}, beforeInsert), [
...Object.keys(sanitizedUpdate.$set || {}),
...Object.keys(sanitizedUpdate.$unset || {}),
]);
if (!is_1.default.emptyObject(setOnInsert)) {
sanitizedUpdate.$setOnInsert = setOnInsert;
}
}
}
});
}
// Validate all fields in the update query.
if (sanitizedUpdate.$set && !is_1.default.emptyObject(sanitizedUpdate.$set)) {
yield this.validateDocument(sanitizedUpdate.$set, Object.assign({ ignoreUniqueIndex: true }, options));
}
// Strip empty objects.
const { $set, $setOnInsert, $addToSet, $push } = sanitizedUpdate, rest = __rest(sanitizedUpdate, ["$set", "$setOnInsert", "$addToSet", "$push"]);
const finalizedUpdate = Object.assign({}, rest, (is_1.default.nullOrUndefined($set) || is_1.default.emptyObject($set)) ? {} : { $set }, (is_1.default.nullOrUndefined($setOnInsert) || is_1.default.emptyObject($setOnInsert)) ? {} : { $setOnInsert }, (is_1.default.nullOrUndefined($addToSet) || is_1.default.emptyObject($addToSet)) ? {} : { $addToSet }, (is_1.default.nullOrUndefined($push) || is_1.default.emptyObject($push)) ? {} : { $push });
return [sanitizedQuery, finalizedUpdate];
});
}
/**
* Handler invoked right after an update. This does not account for
* insertions.
*
* @param oldDoc - The original document.
* @param newDoc - The updated document.
*/
static afterUpdate(oldDoc, newDocs) {
return __awaiter(this, void 0, void 0, function* () {
yield this.didUpdateDocument(oldDoc, newDocs);
});
}
/**
* Handler invoked right before a deletion.
*
* @param query - Query for document to delete.
* @param options - @see ModelDeleteOneOptions, @see ModelDeleteManyOptions
*/
static beforeDelete(query, options) {
return __awaiter(this, void 0, void 0, function* () {
const q = yield this.willDeleteDocument(query);
return sanitizeQuery_1.default(this.schema, q);
});
}
/**
* Handler invoked right after a deletion.
*
* @param doc - The deleted doc, if available.
*
* @todo Cascade deletion only works for first-level foreign keys so far.
*/
static afterDelete(docs) {
return __awaiter(this, void 0, void 0, function* () {
if (is_1.default.array(docs)) {
for (const doc of docs) {
if (!types_1.typeIsValidObjectID(doc._id))
continue;
yield this.cascadeDelete(doc._id);
}
}
else if (!is_1.default.nullOrUndefined(docs) && types_1.typeIsValidObjectID(docs._id)) {
yield this.cascadeDelete(docs._id);
}
yield this.didDeleteDocument(docs);
});
}
/**
* Deletes documents from other collections that have a foreign key to this
* collection, as specified in the schema.
*
* @param docId - The ID of the document in this collection in which other
* collections are pointing to.
*
* @throws {Error} Cascade deletion is incorrectly defined in the schema.
*/
static cascadeDelete(docId) {
return __awaiter(this, void 0, void 0, function* () {
const cascadeModelNames = this.schema.cascade;
if (is_1.default.nullOrUndefined(cascadeModelNames))
return;
if (!is_1.default.array(cascadeModelNames))
throw new Error('Invalid definition of cascade in schema');
for (const modelName of cascadeModelNames) {
const ModelClass = __1.getModel(modelName);
const fields = ModelClass.schema.fields;
assert_1.default(ModelClass, `Trying to cascade delete from model ${modelName} but model is not found`);
for (const key in ModelClass.schema.fields) {
if (!ModelClass.schema.fields.hasOwnProperty(key))
continue;
const field = fields[key];
if (field.ref === this.schema.model) {
log(`Cascade deleting all ${modelName} documents whose "${key}" field is ${docId}`);
yield ModelClass.deleteMany({ [`${key}`]: docId });
}
}
}
});
}
},
/**
* Prevent instantiation of this class or any of its sub-classes because this
* is intended to be a static class.
*
* @throws {Error} Attempting to instantiate this model even though it is
* meant to be a static class.
* Schema of this model. This property must be overridden in the derived
* class.
*/
constructor() {
throw new Error('This is a static class and is prohibited from instantiated');
}
}
exports.default = Model;
_a.schema = schema,
_a; };
//# sourceMappingURL=Model.js.map

@@ -13,3 +13,3 @@ /**

models?: {
[modelName: string]: typeof Model;
[modelName: string]: any;
};

@@ -56,3 +56,3 @@ }

*/
export declare function getModel(modelOrCollectionName: string): typeof Model;
export declare function getModel(modelOrCollectionName: string): ReturnType<typeof Model>;
/**

@@ -59,0 +59,0 @@ * Gets the MongoDB collection associated with a model or collection name and

import { ObjectID } from 'mongodb';
import Model from '../../core/Model';
import { Schema } from '../../types';

@@ -17,4 +16,1275 @@ export interface BarProps {

export declare const BarSchema: Schema<BarProps>;
export default class Bar extends Model {
static schema: Schema<BarProps>;
declare const Bar_base: {
new (): {};
schema: Schema<BarProps>;
getCollection(): Promise<import("mongodb").Collection<any>>;
randomFields(fixedFields?: Partial<import("../../types").Document<BarProps>>, { includeOptionals }?: import("../../types").ModelRandomFieldsOptions): Promise<Partial<import("../../types").Document<BarProps>>>;
pipeline(queryOrSpecs?: string | ObjectID | {
[key: string]: any;
} | import("../../types").PipelineFactorySpecs | {
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aDate?: Date | {
[key: string]: any;
$eq?: Date | undefined;
$gt?: Date | undefined;
$gte?: Date | undefined;
$in?: Date[] | undefined;
$lt?: Date | undefined;
$lte?: Date | undefined;
$ne?: Date | undefined;
$nin?: Date[] | undefined;
$and?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$or?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$not?: Date | (Date | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anObject?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | {
[key: string]: any;
$eq?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$in?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$lt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$lte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$ne?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$nin?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$and?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$or?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$not?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").PipelineFactoryOptions | undefined): import("../../types").AggregationStageDescriptor[];
identifyOneStrict(query: import("../../types").Query<{}>): Promise<ObjectID>;
identifyOne(query: import("../../types").Query<{}>): Promise<ObjectID | null>;
identifyMany(query?: string | ObjectID | {
[key: string]: any;
} | {} | undefined): Promise<ObjectID[]>;
findOneStrict<R = BarProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aDate?: Date | {
[key: string]: any;
$eq?: Date | undefined;
$gt?: Date | undefined;
$gte?: Date | undefined;
$in?: Date[] | undefined;
$lt?: Date | undefined;
$lte?: Date | undefined;
$ne?: Date | undefined;
$nin?: Date[] | undefined;
$and?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$or?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$not?: Date | (Date | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anObject?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | {
[key: string]: any;
$eq?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$in?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$lt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$lte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$ne?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$nin?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$and?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$or?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$not?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R>>;
findOne<R = BarProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aDate?: Date | {
[key: string]: any;
$eq?: Date | undefined;
$gt?: Date | undefined;
$gte?: Date | undefined;
$in?: Date[] | undefined;
$lt?: Date | undefined;
$lte?: Date | undefined;
$ne?: Date | undefined;
$nin?: Date[] | undefined;
$and?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$or?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$not?: Date | (Date | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anObject?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | {
[key: string]: any;
$eq?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$in?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$lt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$lte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$ne?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$nin?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$and?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$or?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$not?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R> | null>;
findMany<R = BarProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aDate?: Date | {
[key: string]: any;
$eq?: Date | undefined;
$gt?: Date | undefined;
$gte?: Date | undefined;
$in?: Date[] | undefined;
$lt?: Date | undefined;
$lte?: Date | undefined;
$ne?: Date | undefined;
$nin?: Date[] | undefined;
$and?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$or?: (Date | {
[key: string]: any;
} | any)[] | undefined;
$not?: Date | (Date | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anObject?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | {
[key: string]: any;
$eq?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$gte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$in?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$lt?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$lte?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$ne?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined;
$nin?: ({
aString: string;
aNumber: number;
aBoolean: boolean;
} | undefined)[] | undefined;
$and?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$or?: ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$not?: {
aString: string;
aNumber: number;
aBoolean: boolean;
} | ({
[key: string]: any;
} | {
aString: string;
aNumber: number;
aBoolean: boolean;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindManyOptions | undefined): Promise<import("../../types").Document<R>[]>;
insertOneStrict(doc?: Partial<import("../../types").Document<BarProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<BarProps>>;
insertOne(doc?: Partial<import("../../types").Document<BarProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<BarProps> | null>;
insertMany(docs: Partial<import("../../types").Document<BarProps>>[], options?: import("../../types").ModelInsertManyOptions): Promise<import("../../types").Document<BarProps>[]>;
updateOneStrict(query: import("../../types").Query<BarProps>, update: import("../../types").Update<BarProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<void | import("../../types").Document<BarProps>>;
updateOne(query: import("../../types").Query<BarProps>, update: import("../../types").Update<BarProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<boolean | import("../../types").Document<BarProps> | null>;
updateMany(query: import("../../types").Query<BarProps>, update: import("../../types").Update<BarProps>, options?: import("../../types").ModelUpdateManyOptions): Promise<boolean | import("../../types").Document<BarProps>[]>;
deleteOneStrict(query: import("../../types").Query<BarProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<void | import("../../types").Document<BarProps>>;
deleteOne(query: import("../../types").Query<BarProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<boolean | import("../../types").Document<BarProps> | null>;
deleteMany(query: import("../../types").Query<BarProps>, options?: import("../../types").ModelDeleteManyOptions): Promise<boolean | import("../../types").Document<BarProps>[]>;
findAndReplaceOneStrict(query: import("../../types").Query<BarProps>, replacement?: Partial<import("../../types").Document<BarProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<BarProps>>;
findAndReplaceOne(query: import("../../types").Query<BarProps>, replacement?: Partial<import("../../types").Document<BarProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<BarProps> | null>;
exists(query: import("../../types").Query<{}>): Promise<boolean>;
count(query: import("../../types").Query<{}>, options?: import("../../types").ModelCountOptions): Promise<number>;
formatDocument(doc: Partial<import("../../types").Document<BarProps>>): Promise<Partial<import("../../types").Document<BarProps>>>;
validateDocument(doc: Partial<import("../../types").Document<BarProps>>, options?: import("../../types").ModelValidateDocumentOptions): Promise<boolean>;
willInsertDocument(doc: Partial<import("../../types").Document<BarProps>>): Promise<Partial<import("../../types").Document<BarProps>>>;
didInsertDocument<R = BarProps>(doc: import("../../types").Document<R>): Promise<void>;
willUpdateDocument(query: import("../../types").Query<BarProps>, update: import("../../types").Update<BarProps>): Promise<[import("../../types").Query<{}>, import("../../types").Update<BarProps>]>;
didUpdateDocument(prevDoc?: import("../../types").Document<BarProps> | undefined, newDocs?: import("../../types").Document<BarProps> | import("../../types").Document<BarProps>[] | undefined): Promise<void>;
willDeleteDocument(query: import("../../types").Query<BarProps>): Promise<import("../../types").Query<BarProps>>;
didDeleteDocument(docs?: import("../../types").Document<BarProps> | import("../../types").Document<BarProps>[] | undefined): Promise<void>;
beforeInsert(doc: Partial<import("../../types").Document<BarProps>>, options?: import("../../types").ModelInsertOneOptions | import("../../types").ModelInsertManyOptions): Promise<Partial<import("../../types").Document<BarProps>>>;
afterInsert<R>(doc: import("../../types").Document<R>): Promise<void>;
beforeUpdate(query: import("../../types").Query<BarProps>, update: import("../../types").Update<BarProps>, options?: import("../../types").ModelUpdateOneOptions | import("../../types").ModelUpdateManyOptions): Promise<[Partial<import("../../types").Document<BarProps>>, import("mongodb").UpdateQuery<Partial<import("../../types").Document<BarProps>>>]>;
afterUpdate(oldDoc?: import("../../types").Document<BarProps> | undefined, newDocs?: import("../../types").Document<BarProps> | import("../../types").Document<BarProps>[] | undefined): Promise<void>;
beforeDelete(query: import("../../types").Query<BarProps>, options: import("../../types").ModelDeleteOneOptions | import("../../types").ModelDeleteManyOptions): Promise<import("mongodb").FilterQuery<BarProps>>;
afterDelete(docs?: import("../../types").Document<BarProps> | import("../../types").Document<BarProps>[] | undefined): Promise<void>;
cascadeDelete(docId: ObjectID): Promise<void>;
};
export default class Bar extends Bar_base {
}
export {};

@@ -49,6 +49,5 @@ "use strict";

};
class Bar extends Model_1.default {
class Bar extends Model_1.default(exports.BarSchema) {
}
Bar.schema = exports.BarSchema;
exports.default = Bar;
//# sourceMappingURL=Bar.js.map

@@ -1,2 +0,2 @@

import Model from '../../core/Model';
/// <reference types="mongodb" />
import { Schema } from '../../types';

@@ -11,4 +11,899 @@ export interface BazProps {

export declare const BazSchema: Schema<BazProps>;
export default class Baz extends Model {
static schema: Schema<BazProps>;
declare const Baz_base: {
new (): {};
schema: Schema<BazProps>;
getCollection(): Promise<import("mongodb").Collection<any>>;
randomFields(fixedFields?: Partial<import("../../types").Document<BazProps>>, { includeOptionals }?: import("../../types").ModelRandomFieldsOptions): Promise<Partial<import("../../types").Document<BazProps>>>;
pipeline(queryOrSpecs?: string | import("bson").ObjectID | {
[key: string]: any;
} | import("../../types").PipelineFactorySpecs | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: (number | undefined)[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: (number | undefined)[] | undefined;
$and?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: number | (number | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFormattedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anEncryptedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").PipelineFactoryOptions | undefined): import("../../types").AggregationStageDescriptor[];
identifyOneStrict(query: import("../../types").Query<{}>): Promise<import("bson").ObjectID>;
identifyOne(query: import("../../types").Query<{}>): Promise<import("bson").ObjectID | null>;
identifyMany(query?: string | import("bson").ObjectID | {
[key: string]: any;
} | {} | undefined): Promise<import("bson").ObjectID[]>;
findOneStrict<R = BazProps>(query?: string | import("bson").ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: (number | undefined)[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: (number | undefined)[] | undefined;
$and?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: number | (number | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFormattedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anEncryptedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R>>;
findOne<R = BazProps>(query?: string | import("bson").ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: (number | undefined)[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: (number | undefined)[] | undefined;
$and?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: number | (number | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFormattedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anEncryptedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R> | null>;
findMany<R = BazProps>(query?: string | import("bson").ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: (number | undefined)[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: (number | undefined)[] | undefined;
$and?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (number | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: number | (number | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBoolean?: boolean | {
[key: string]: any;
$eq?: boolean | undefined;
$gt?: boolean | undefined;
$gte?: boolean | undefined;
$in?: (boolean | undefined)[] | undefined;
$lt?: boolean | undefined;
$lte?: boolean | undefined;
$ne?: boolean | undefined;
$nin?: (boolean | undefined)[] | undefined;
$and?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: boolean | (boolean | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFormattedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
anEncryptedString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: (string | undefined)[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: (string | undefined)[] | undefined;
$and?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$or?: (string | {
[key: string]: any;
} | undefined)[] | undefined;
$not?: string | (string | {
[key: string]: any;
} | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindManyOptions | undefined): Promise<import("../../types").Document<R>[]>;
insertOneStrict(doc?: Partial<import("../../types").Document<BazProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<BazProps>>;
insertOne(doc?: Partial<import("../../types").Document<BazProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<BazProps> | null>;
insertMany(docs: Partial<import("../../types").Document<BazProps>>[], options?: import("../../types").ModelInsertManyOptions): Promise<import("../../types").Document<BazProps>[]>;
updateOneStrict(query: import("../../types").Query<BazProps>, update: import("../../types").Update<BazProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<void | import("../../types").Document<BazProps>>;
updateOne(query: import("../../types").Query<BazProps>, update: import("../../types").Update<BazProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<boolean | import("../../types").Document<BazProps> | null>;
updateMany(query: import("../../types").Query<BazProps>, update: import("../../types").Update<BazProps>, options?: import("../../types").ModelUpdateManyOptions): Promise<boolean | import("../../types").Document<BazProps>[]>;
deleteOneStrict(query: import("../../types").Query<BazProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<void | import("../../types").Document<BazProps>>;
deleteOne(query: import("../../types").Query<BazProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<boolean | import("../../types").Document<BazProps> | null>;
deleteMany(query: import("../../types").Query<BazProps>, options?: import("../../types").ModelDeleteManyOptions): Promise<boolean | import("../../types").Document<BazProps>[]>;
findAndReplaceOneStrict(query: import("../../types").Query<BazProps>, replacement?: Partial<import("../../types").Document<BazProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<BazProps>>;
findAndReplaceOne(query: import("../../types").Query<BazProps>, replacement?: Partial<import("../../types").Document<BazProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<BazProps> | null>;
exists(query: import("../../types").Query<{}>): Promise<boolean>;
count(query: import("../../types").Query<{}>, options?: import("../../types").ModelCountOptions): Promise<number>;
formatDocument(doc: Partial<import("../../types").Document<BazProps>>): Promise<Partial<import("../../types").Document<BazProps>>>;
validateDocument(doc: Partial<import("../../types").Document<BazProps>>, options?: import("../../types").ModelValidateDocumentOptions): Promise<boolean>;
willInsertDocument(doc: Partial<import("../../types").Document<BazProps>>): Promise<Partial<import("../../types").Document<BazProps>>>;
didInsertDocument<R = BazProps>(doc: import("../../types").Document<R>): Promise<void>;
willUpdateDocument(query: import("../../types").Query<BazProps>, update: import("../../types").Update<BazProps>): Promise<[import("../../types").Query<{}>, import("../../types").Update<BazProps>]>;
didUpdateDocument(prevDoc?: import("../../types").Document<BazProps> | undefined, newDocs?: import("../../types").Document<BazProps> | import("../../types").Document<BazProps>[] | undefined): Promise<void>;
willDeleteDocument(query: import("../../types").Query<BazProps>): Promise<import("../../types").Query<BazProps>>;
didDeleteDocument(docs?: import("../../types").Document<BazProps> | import("../../types").Document<BazProps>[] | undefined): Promise<void>;
beforeInsert(doc: Partial<import("../../types").Document<BazProps>>, options?: import("../../types").ModelInsertOneOptions | import("../../types").ModelInsertManyOptions): Promise<Partial<import("../../types").Document<BazProps>>>;
afterInsert<R>(doc: import("../../types").Document<R>): Promise<void>;
beforeUpdate(query: import("../../types").Query<BazProps>, update: import("../../types").Update<BazProps>, options?: import("../../types").ModelUpdateOneOptions | import("../../types").ModelUpdateManyOptions): Promise<[Partial<import("../../types").Document<BazProps>>, import("mongodb").UpdateQuery<Partial<import("../../types").Document<BazProps>>>]>;
afterUpdate(oldDoc?: import("../../types").Document<BazProps> | undefined, newDocs?: import("../../types").Document<BazProps> | import("../../types").Document<BazProps>[] | undefined): Promise<void>;
beforeDelete(query: import("../../types").Query<BazProps>, options: import("../../types").ModelDeleteOneOptions | import("../../types").ModelDeleteManyOptions): Promise<import("mongodb").FilterQuery<BazProps>>;
afterDelete(docs?: import("../../types").Document<BazProps> | import("../../types").Document<BazProps>[] | undefined): Promise<void>;
cascadeDelete(docId: import("bson").ObjectID): Promise<void>;
};
export default class Baz extends Baz_base {
}
export {};

@@ -23,6 +23,5 @@ "use strict";

};
class Baz extends Model_1.default {
class Baz extends Model_1.default(exports.BazSchema) {
}
Baz.schema = exports.BazSchema;
exports.default = Baz;
//# sourceMappingURL=Baz.js.map
import { ObjectID } from 'mongodb';
import Model from '../../core/Model';
import { Schema } from '../../types';

@@ -11,4 +10,731 @@ export interface FooProps {

export declare const FooSchema: Schema<FooProps>;
export default class Foo extends Model {
static schema: Schema<FooProps>;
declare const Foo_base: {
new (): {};
schema: Schema<FooProps>;
getCollection(): Promise<import("mongodb").Collection<any>>;
randomFields(fixedFields?: Partial<import("../../types").Document<FooProps>>, { includeOptionals }?: import("../../types").ModelRandomFieldsOptions): Promise<Partial<import("../../types").Document<FooProps>>>;
pipeline(queryOrSpecs?: string | ObjectID | {
[key: string]: any;
} | import("../../types").PipelineFactorySpecs | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFoo?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: (ObjectID | undefined)[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: (ObjectID | undefined)[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").PipelineFactoryOptions | undefined): import("../../types").AggregationStageDescriptor[];
identifyOneStrict(query: import("../../types").Query<{}>): Promise<ObjectID>;
identifyOne(query: import("../../types").Query<{}>): Promise<ObjectID | null>;
identifyMany(query?: string | ObjectID | {
[key: string]: any;
} | {} | undefined): Promise<ObjectID[]>;
findOneStrict<R = FooProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFoo?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: (ObjectID | undefined)[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: (ObjectID | undefined)[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R>>;
findOne<R = FooProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFoo?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: (ObjectID | undefined)[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: (ObjectID | undefined)[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindOneOptions | undefined): Promise<import("../../types").Document<R> | null>;
findMany<R = FooProps>(query?: string | ObjectID | {
[key: string]: any;
} | {
aString?: string | {
[key: string]: any;
$eq?: string | undefined;
$gt?: string | undefined;
$gte?: string | undefined;
$in?: string[] | undefined;
$lt?: string | undefined;
$lte?: string | undefined;
$ne?: string | undefined;
$nin?: string[] | undefined;
$and?: (string | {
[key: string]: any;
})[] | undefined;
$or?: (string | {
[key: string]: any;
})[] | undefined;
$not?: string | (string | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aNumber?: number | {
[key: string]: any;
$eq?: number | undefined;
$gt?: number | undefined;
$gte?: number | undefined;
$in?: number[] | undefined;
$lt?: number | undefined;
$lte?: number | undefined;
$ne?: number | undefined;
$nin?: number[] | undefined;
$and?: (number | {
[key: string]: any;
})[] | undefined;
$or?: (number | {
[key: string]: any;
})[] | undefined;
$not?: number | (number | {
[key: string]: any;
})[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aBar?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: ObjectID[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: ObjectID[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
aFoo?: ObjectID | {
[key: string]: any;
$eq?: ObjectID | undefined;
$gt?: ObjectID | undefined;
$gte?: ObjectID | undefined;
$in?: (ObjectID | undefined)[] | undefined;
$lt?: ObjectID | undefined;
$lte?: ObjectID | undefined;
$ne?: ObjectID | undefined;
$nin?: (ObjectID | undefined)[] | undefined;
$and?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$or?: (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$not?: ObjectID | (ObjectID | {
[key: string]: any;
} | any | undefined)[] | undefined;
$expr?: any;
$jsonSchema?: any;
$mod?: [number, number] | undefined;
$regex?: RegExp | undefined;
$options?: string | undefined;
$text?: {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacraticSensitive?: boolean | undefined;
} | undefined;
$where: Object;
$geoIntersects?: Object | undefined;
$geoWithin?: Object | undefined;
$near?: Object | undefined;
$nearSphere?: Object | undefined;
$elemMatch?: Object | undefined;
$size?: number | undefined;
$bitsAllClear?: Object | undefined;
$bitsAllSet?: Object | undefined;
$bitsAnyClear?: Object | undefined;
$bitsAnySet?: Object | undefined;
} | undefined;
} | undefined, options?: import("../../types").ModelFindManyOptions | undefined): Promise<import("../../types").Document<R>[]>;
insertOneStrict(doc?: Partial<import("../../types").Document<FooProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<FooProps>>;
insertOne(doc?: Partial<import("../../types").Document<FooProps>> | undefined, options?: import("../../types").ModelInsertOneOptions | undefined): Promise<import("../../types").Document<FooProps> | null>;
insertMany(docs: Partial<import("../../types").Document<FooProps>>[], options?: import("../../types").ModelInsertManyOptions): Promise<import("../../types").Document<FooProps>[]>;
updateOneStrict(query: import("../../types").Query<FooProps>, update: import("../../types").Update<FooProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<void | import("../../types").Document<FooProps>>;
updateOne(query: import("../../types").Query<FooProps>, update: import("../../types").Update<FooProps>, options?: import("../../types").ModelUpdateOneOptions): Promise<boolean | import("../../types").Document<FooProps> | null>;
updateMany(query: import("../../types").Query<FooProps>, update: import("../../types").Update<FooProps>, options?: import("../../types").ModelUpdateManyOptions): Promise<boolean | import("../../types").Document<FooProps>[]>;
deleteOneStrict(query: import("../../types").Query<FooProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<void | import("../../types").Document<FooProps>>;
deleteOne(query: import("../../types").Query<FooProps>, options?: import("../../types").ModelDeleteOneOptions): Promise<boolean | import("../../types").Document<FooProps> | null>;
deleteMany(query: import("../../types").Query<FooProps>, options?: import("../../types").ModelDeleteManyOptions): Promise<boolean | import("../../types").Document<FooProps>[]>;
findAndReplaceOneStrict(query: import("../../types").Query<FooProps>, replacement?: Partial<import("../../types").Document<FooProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<FooProps>>;
findAndReplaceOne(query: import("../../types").Query<FooProps>, replacement?: Partial<import("../../types").Document<FooProps>> | undefined, options?: import("../../types").ModelReplaceOneOptions): Promise<import("../../types").Document<FooProps> | null>;
exists(query: import("../../types").Query<{}>): Promise<boolean>;
count(query: import("../../types").Query<{}>, options?: import("../../types").ModelCountOptions): Promise<number>;
formatDocument(doc: Partial<import("../../types").Document<FooProps>>): Promise<Partial<import("../../types").Document<FooProps>>>;
validateDocument(doc: Partial<import("../../types").Document<FooProps>>, options?: import("../../types").ModelValidateDocumentOptions): Promise<boolean>;
willInsertDocument(doc: Partial<import("../../types").Document<FooProps>>): Promise<Partial<import("../../types").Document<FooProps>>>;
didInsertDocument<R = FooProps>(doc: import("../../types").Document<R>): Promise<void>;
willUpdateDocument(query: import("../../types").Query<FooProps>, update: import("../../types").Update<FooProps>): Promise<[import("../../types").Query<{}>, import("../../types").Update<FooProps>]>;
didUpdateDocument(prevDoc?: import("../../types").Document<FooProps> | undefined, newDocs?: import("../../types").Document<FooProps> | import("../../types").Document<FooProps>[] | undefined): Promise<void>;
willDeleteDocument(query: import("../../types").Query<FooProps>): Promise<import("../../types").Query<FooProps>>;
didDeleteDocument(docs?: import("../../types").Document<FooProps> | import("../../types").Document<FooProps>[] | undefined): Promise<void>;
beforeInsert(doc: Partial<import("../../types").Document<FooProps>>, options?: import("../../types").ModelInsertOneOptions | import("../../types").ModelInsertManyOptions): Promise<Partial<import("../../types").Document<FooProps>>>;
afterInsert<R>(doc: import("../../types").Document<R>): Promise<void>;
beforeUpdate(query: import("../../types").Query<FooProps>, update: import("../../types").Update<FooProps>, options?: import("../../types").ModelUpdateOneOptions | import("../../types").ModelUpdateManyOptions): Promise<[Partial<import("../../types").Document<FooProps>>, import("mongodb").UpdateQuery<Partial<import("../../types").Document<FooProps>>>]>;
afterUpdate(oldDoc?: import("../../types").Document<FooProps> | undefined, newDocs?: import("../../types").Document<FooProps> | import("../../types").Document<FooProps>[] | undefined): Promise<void>;
beforeDelete(query: import("../../types").Query<FooProps>, options: import("../../types").ModelDeleteOneOptions | import("../../types").ModelDeleteManyOptions): Promise<import("mongodb").FilterQuery<FooProps>>;
afterDelete(docs?: import("../../types").Document<FooProps> | import("../../types").Document<FooProps>[] | undefined): Promise<void>;
cascadeDelete(docId: ObjectID): Promise<void>;
};
export default class Foo extends Foo_base {
}
export {};

@@ -39,6 +39,5 @@ "use strict";

};
class Foo extends Model_1.default {
class Foo extends Model_1.default(exports.FooSchema) {
}
Foo.schema = exports.FooSchema;
exports.default = Foo;
//# sourceMappingURL=Foo.js.map
{
"name": "@andrewscwei/mongodb-odm",
"version": "0.25.0",
"version": "0.26.0",
"description": "ODM for MongoDB",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc