diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index a2a30c9f1e..d9d6a21bdc 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -482,13 +482,13 @@ export interface Collection { createIndexes(indexSpecs: Object[], options?: {session?: ClientSession}): Promise; createIndexes(indexSpecs: Object[], options: {session?: ClientSession}, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteMany */ - deleteMany(filter: Object, callback: MongoCallback): void; - deleteMany(filter: Object, options?: CommonOptions): Promise; - deleteMany(filter: Object, options: CommonOptions, callback: MongoCallback): void; + deleteMany(filter: FilterQuery, callback: MongoCallback): void; + deleteMany(filter: FilterQuery, options?: CommonOptions): Promise; + deleteMany(filter: FilterQuery, options: CommonOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteOne */ - deleteOne(filter: Object, callback: MongoCallback): void; - deleteOne(filter: Object, options?: CommonOptions & { bypassDocumentValidation?: boolean }): Promise; - deleteOne(filter: Object, options: CommonOptions & { bypassDocumentValidation?: boolean }, callback: MongoCallback): void; + deleteOne(filter: FilterQuery, callback: MongoCallback): void; + deleteOne(filter: FilterQuery, options?: CommonOptions & { bypassDocumentValidation?: boolean }): Promise; + deleteOne(filter: FilterQuery, options: CommonOptions & { bypassDocumentValidation?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#distinct */ distinct(key: string, query: Object, callback: MongoCallback): void; distinct(key: string, query: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number, session?: ClientSession }): Promise; @@ -510,21 +510,21 @@ export interface Collection { /** @deprecated */ find(query: Object, options?: FindOneOptions): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOne */ - findOne(filter: Object, callback: MongoCallback): void; - findOne(filter: Object, options?: FindOneOptions): Promise; - findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; + findOne(filter: FilterQuery, callback: MongoCallback): void; + findOne(filter: FilterQuery, options?: FindOneOptions): Promise; + findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndDelete */ - findOneAndDelete(filter: Object, callback: MongoCallback>): void; - findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; - findOneAndDelete(filter: Object, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; + findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; + findOneAndDelete(filter: FilterQuery, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; + findOneAndDelete(filter: FilterQuery, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndReplace */ - findOneAndReplace(filter: Object, replacement: Object, callback: MongoCallback>): void; - findOneAndReplace(filter: Object, replacement: Object, options?: FindOneAndReplaceOption): Promise>; - findOneAndReplace(filter: Object, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; + findOneAndReplace(filter: FilterQuery, replacement: Object, callback: MongoCallback>): void; + findOneAndReplace(filter: FilterQuery, replacement: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndReplace(filter: FilterQuery, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndUpdate */ - findOneAndUpdate(filter: Object, update: Object, callback: MongoCallback>): void; - findOneAndUpdate(filter: Object, update: Object, options?: FindOneAndReplaceOption): Promise>; - findOneAndUpdate(filter: Object, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; + findOneAndUpdate(filter: FilterQuery, update: Object, callback: MongoCallback>): void; + findOneAndUpdate(filter: FilterQuery, update: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndUpdate(filter: FilterQuery, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoHaystackSearch */ geoHaystackSearch(x: number, y: number, callback: MongoCallback): void; geoHaystackSearch(x: number, y: number, options?: GeoHaystackSearchOptions): Promise; @@ -602,9 +602,9 @@ export interface Collection { rename(newName: string, options?: { dropTarget?: boolean, session?: ClientSession }): Promise>; rename(newName: string, options: { dropTarget?: boolean, session?: ClientSession }, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#replaceOne */ - replaceOne(filter: Object, doc: Object, callback: MongoCallback): void; - replaceOne(filter: Object, doc: Object, options?: ReplaceOneOptions): Promise; - replaceOne(filter: Object, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; + replaceOne(filter: FilterQuery, doc: Object, callback: MongoCallback): void; + replaceOne(filter: FilterQuery, doc: Object, options?: ReplaceOneOptions): Promise; + replaceOne(filter: FilterQuery, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#save */ /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ save(doc: Object, callback: MongoCallback): void; @@ -618,19 +618,19 @@ export interface Collection { stats(options: { scale: number, session?: ClientSession }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#update */ /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, callback: MongoCallback): void; + update(filter: FilterQuery, update: Object, callback: MongoCallback): void; /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; + update(filter: FilterQuery, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; + update(filter: FilterQuery, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateMany */ - updateMany(filter: Object, update: Object, callback: MongoCallback): void; - updateMany(filter: Object, update: Object, options?: CommonOptions & { upsert?: boolean }): Promise; - updateMany(filter: Object, update: Object, options: CommonOptions & { upsert?: boolean }, callback: MongoCallback): void; + updateMany(filter: FilterQuery, update: Object, callback: MongoCallback): void; + updateMany(filter: FilterQuery, update: Object, options?: CommonOptions & { upsert?: boolean }): Promise; + updateMany(filter: FilterQuery, update: Object, options: CommonOptions & { upsert?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateOne */ - updateOne(filter: Object, update: Object, callback: MongoCallback): void; - updateOne(filter: Object, update: Object, options?: ReplaceOneOptions): Promise; - updateOne(filter: Object, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void; + updateOne(filter: FilterQuery, update: Object, callback: MongoCallback): void; + updateOne(filter: FilterQuery, update: Object, options?: ReplaceOneOptions): Promise; + updateOne(filter: FilterQuery, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#watch */ watch(pipeline?: Object[], options?: ChangeStreamOptions & { session?: ClientSession }): ChangeStream; }