Socket
Socket
Sign inDemoInstall

monk

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monk - npm Package Compare versions

Comparing version 7.3.2 to 7.3.3

4

CHANGELOG.md

@@ -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 @@

7

lib/collection.js

@@ -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",

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