Skip to content

Commit

Permalink
add docs to: FilterQuery, UpdateQuery, and LeanDocument, types
Browse files Browse the repository at this point in the history
  • Loading branch information
Moisei-Shkil committed Feb 27, 2022
1 parent 601650a commit 1846cbe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,12 @@ declare module 'mongoose' {
} &
RootQuerySelector<T>;

/**
* Filter query to select the documents that match the query
* @example ```js
* { "age": { "$gte": 30 } }
* ```
*/
export type FilterQuery<T> = _FilterQuery<T>;

type AddToSetOperators<Type> = {
Expand Down Expand Up @@ -2544,6 +2550,12 @@ declare module 'mongoose' {
[K in keyof T]?: __UpdateDefProperty<T[K]>;
};

/**
* Update query command to perform on the document
* @example ```js
* { "age": 30 }
* ```
*/
export type UpdateQuery<T> = _UpdateQuery<_UpdateQueryDef<T>> & AnyObject;

export type DocumentDefinition<T> = {
Expand Down Expand Up @@ -2586,6 +2598,12 @@ declare module 'mongoose' {
T;

export type SchemaDefinitionType<T> = T extends Document ? Omit<T, Exclude<keyof Document, '_id' | 'id' | '__v'>> : T;

/**
* Documents returned from queries with the lean option enabled.
* Plain old JavaScript object documents (POJO).
* @see https://mongoosejs.com/docs/tutorials/lean.html
*/
export type LeanDocument<T> = Omit<_LeanDocument<T>, Exclude<keyof Document, '_id' | 'id' | '__v'> | '$isSingleNested'>;

export type LeanDocumentOrArray<T> = 0 extends (1 & T) ? T :
Expand Down

0 comments on commit 1846cbe

Please sign in to comment.