Comparing version 7.3.2 to 7.3.3
@@ -0,1 +1,5 @@ | ||
# 7.3.3 / 2021-01-27 | ||
- Fixes bug in .d.ts where all queries are assumed to be rawCursor queries (Thanks @zkldi!) | ||
# 7.3.2 / 2020-08-31 | ||
@@ -2,0 +6,0 @@ |
@@ -10,2 +10,4 @@ declare module "monk" { | ||
UpdateOneOptions, | ||
UpdateManyOptions, | ||
ReplaceOneOptions, | ||
CollectionInsertOneOptions, | ||
@@ -101,3 +103,3 @@ Cursor, | ||
readonly close: () => Promise<void>; | ||
readonly listCollections: (query?: Object) => Array<ICollection>; | ||
readonly listCollections: (query?: Object) => Promise<Array<ICollection>>; | ||
@@ -201,3 +203,3 @@ get<T = any>(name: string, options?: CollectionOptions): ICollection<T>; | ||
query: FilterQuery<T>, | ||
options?: FindOptions<T> & { rawCursor: true } | ||
options: FindOptions<T> & { rawCursor: true } | ||
): Promise<FindRawResult<T>>; | ||
@@ -244,3 +246,3 @@ find( | ||
update: UpdateQuery<T> | Partial<T>, | ||
options?: FindOneAndUpdateOption<T> & { replaceOne?: false } | ||
options?: FindOneAndUpdateOption<T> & { replace?: false } | ||
): Promise<FindOneResult<T>>; | ||
@@ -250,3 +252,3 @@ findOneAndUpdate( | ||
update: UpdateQuery<T> | Partial<T>, | ||
options?: FindOneAndUpdateOption<T> & { replaceOne?: false }, | ||
options?: FindOneAndUpdateOption<T> & { replace?: false }, | ||
callback?: Callback<FindOneResult<T>> | ||
@@ -258,3 +260,3 @@ ): void; | ||
update: T, | ||
options?: FindOneAndReplaceOption<T> & { replaceOne: true } | ||
options?: FindOneAndReplaceOption<T> & { replace: true } | ||
): Promise<FindOneResult<T>>; | ||
@@ -264,3 +266,3 @@ findOneAndUpdate( | ||
update: T, | ||
options: FindOneAndReplaceOption<T> & { replaceOne: true }, | ||
options: FindOneAndReplaceOption<T> & { replace: true }, | ||
callback: Callback<FindOneResult<T>> | ||
@@ -340,6 +342,7 @@ ): void; | ||
// single | ||
update( | ||
query: FilterQuery<T>, | ||
update: UpdateQuery<T> | Partial<T>, | ||
options?: UpdateOneOptions | ||
options?: UpdateOneOptions & { single?: true, multi?: false, replace?: false} | ||
): Promise<UpdateWriteOpResult>; | ||
@@ -349,5 +352,29 @@ update( | ||
update: UpdateQuery<T> | Partial<T>, | ||
options: UpdateOneOptions, | ||
options: UpdateOneOptions & { single?: true, multi?: false, replace?: false}, | ||
callback: Callback<UpdateWriteOpResult> | ||
): void; | ||
// multi | ||
update( | ||
query: FilterQuery<T>, | ||
update: UpdateQuery<T> | Partial<T>, | ||
options?: UpdateManyOptions & ({ single?: false, multi: true, replace?: false} | { single: false, multi?: true, replace?: false}) | ||
): Promise<UpdateWriteOpResult>; | ||
update( | ||
query: FilterQuery<T>, | ||
update: UpdateQuery<T> | Partial<T>, | ||
options: UpdateOneOptions & ({ single?: false, multi: true, replace?: false} | { single: false, multi?: true, replace?: false}), | ||
callback: Callback<UpdateWriteOpResult> | ||
): void; | ||
// replace | ||
update( | ||
query: FilterQuery<T>, | ||
update: UpdateQuery<T> | Partial<T>, | ||
options?: ReplaceOneOptions & { single?: true, multi?: false, replace: true} | ||
): Promise<UpdateWriteOpResult>; | ||
update( | ||
query: FilterQuery<T>, | ||
update: UpdateQuery<T> | Partial<T>, | ||
options: ReplaceOneOptions & { single?: true, multi?: false, replace: true}, | ||
callback: Callback<UpdateWriteOpResult> | ||
): void; | ||
} | ||
@@ -354,0 +381,0 @@ |
@@ -275,3 +275,3 @@ var applyMiddlewares = require('./applyMiddlewares') | ||
} | ||
if (args.options.replaceOne) { | ||
if (args.options.replaceOne | args.options.replace) { | ||
method = 'findOneAndReplace' | ||
@@ -385,3 +385,6 @@ } | ||
var method = options.multi || options.single === false ? 'updateMany' : 'updateOne' | ||
if (options.replaceOne) { | ||
if (options.replace || options.replaceOne) { | ||
if (options.multi || options.single === false) { | ||
throw new Error('The `replace` option is only available for single updates.') | ||
} | ||
method = 'replaceOne' | ||
@@ -388,0 +391,0 @@ } |
{ | ||
"name": "monk", | ||
"description": "The wise MongoDB API", | ||
"version": "7.3.2", | ||
"version": "7.3.3", | ||
"main": "lib/monk.js", | ||
@@ -6,0 +6,0 @@ "types": "./index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47701
1085