mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fix(@types/mongodb): make _id optional for collection.insertX functions (#37402)
This commit is contained in:
parent
bbee6fcddf
commit
e949e6fec6
2
types/agenda/index.d.ts
vendored
2
types/agenda/index.d.ts
vendored
@ -3,7 +3,7 @@
|
||||
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
|
||||
// Jeff Principe <https://github.com/princjef>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
4
types/connect-mongodb-session/index.d.ts
vendored
4
types/connect-mongodb-session/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/kcbanner/connect-mongodb-session
|
||||
// Definitions by: Nattapong Sirilappanich <https://github.com/NattapongSiri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="express-session" />
|
||||
|
||||
@ -28,4 +28,4 @@ declare namespace connectMongodbSession {
|
||||
}
|
||||
}
|
||||
|
||||
export = connect
|
||||
export = connect
|
||||
|
||||
4
types/gridfs-stream/index.d.ts
vendored
4
types/gridfs-stream/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/aheckmann/gridfs-stream
|
||||
// Definitions by: Lior Mualem <https://github.com/liorm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@ -66,5 +66,3 @@ declare namespace g {
|
||||
}
|
||||
|
||||
export = g;
|
||||
|
||||
|
||||
|
||||
30
types/mongodb/index.d.ts
vendored
30
types/mongodb/index.d.ts
vendored
@ -24,8 +24,9 @@
|
||||
// Nick Zahn <https://github.com/Manc>
|
||||
// Jarom Loveridge <https://github.com/jloveridge>
|
||||
// Luis Pais <https://github.com/ranguna>
|
||||
// Hossein Saniei <https://github.com/HosseinAgha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
// Documentation: https://mongodb.github.io/node-mongodb-native/3.1/api/
|
||||
|
||||
@ -36,6 +37,9 @@ import { EventEmitter } from 'events';
|
||||
import { Readable, Writable } from "stream";
|
||||
import { checkServerIdentity } from "tls";
|
||||
|
||||
// This line can be removed after minimum required TypeScript Version is above 3.5
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
export function connect(uri: string, options?: MongoClientOptions): Promise<MongoClient>;
|
||||
export function connect(uri: string, callback: MongoCallback<MongoClient>): void;
|
||||
export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback<MongoClient>): void;
|
||||
@ -127,7 +131,7 @@ export interface ClientSession extends EventEmitter {
|
||||
* Starts a new transaction with the given options.
|
||||
*/
|
||||
startTransaction(options?: TransactionOptions): void;
|
||||
|
||||
|
||||
/**
|
||||
* Runs a provided lambda within a transaction, retrying either the commit operation
|
||||
* or entire transaction as needed (and when the error permits) to better ensure that
|
||||
@ -135,7 +139,7 @@ export interface ClientSession extends EventEmitter {
|
||||
*
|
||||
* IMPORTANT: This method requires the user to return a Promise, all lambdas that do not
|
||||
* return a Promise will result in undefined behavior.
|
||||
*
|
||||
*
|
||||
* @param fn Function to execute with the new session.
|
||||
* @param options Optional settings for the transaction
|
||||
*/
|
||||
@ -846,6 +850,8 @@ export interface FSyncOptions extends CommonOptions {
|
||||
fsync?: boolean;
|
||||
}
|
||||
|
||||
type OptionalId<TSchema> = Omit<TSchema, '_id'> & { _id?: any };
|
||||
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html */
|
||||
export interface Collection<TSchema = Default> {
|
||||
/**
|
||||
@ -994,19 +1000,19 @@ export interface Collection<TSchema = Default> {
|
||||
initializeUnorderedBulkOp(options?: CommonOptions): UnorderedBulkOperation;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */
|
||||
/** @deprecated Use insertOne, insertMany or bulkWrite */
|
||||
insert(docs: TSchema, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
insert(docs: OptionalId<TSchema>, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
/** @deprecated Use insertOne, insertMany or bulkWrite */
|
||||
insert(docs: TSchema, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult>;
|
||||
insert(docs: OptionalId<TSchema>, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult>;
|
||||
/** @deprecated Use insertOne, insertMany or bulkWrite */
|
||||
insert(docs: TSchema, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
insert(docs: OptionalId<TSchema>, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertMany */
|
||||
insertMany(docs: TSchema[], callback: MongoCallback<InsertWriteOpResult>): void;
|
||||
insertMany(docs: TSchema[], options?: CollectionInsertManyOptions): Promise<InsertWriteOpResult>;
|
||||
insertMany(docs: TSchema[], options: CollectionInsertManyOptions, callback: MongoCallback<InsertWriteOpResult>): void;
|
||||
insertMany(docs: Array<OptionalId<TSchema>>, callback: MongoCallback<InsertWriteOpResult>): void;
|
||||
insertMany(docs: Array<OptionalId<TSchema>>, options?: CollectionInsertManyOptions): Promise<InsertWriteOpResult>;
|
||||
insertMany(docs: Array<OptionalId<TSchema>>, options: CollectionInsertManyOptions, callback: MongoCallback<InsertWriteOpResult>): void;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */
|
||||
insertOne(docs: TSchema, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
insertOne(docs: TSchema, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult>;
|
||||
insertOne(docs: TSchema, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
insertOne(docs: OptionalId<TSchema>, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
insertOne(docs: OptionalId<TSchema>, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult>;
|
||||
insertOne(docs: OptionalId<TSchema>, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult>): void;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#isCapped */
|
||||
isCapped(options?: { session: ClientSession }): Promise<any>;
|
||||
isCapped(callback: MongoCallback<any>): void;
|
||||
|
||||
2
types/mongoose/v4/index.d.ts
vendored
2
types/mongoose/v4/index.d.ts
vendored
@ -5,7 +5,7 @@
|
||||
// lukasz-zak <https://github.com/lukasz-zak>
|
||||
// murbanowicz <https://github.com/murbanowicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="mongodb" />
|
||||
/// <reference types="node" />
|
||||
|
||||
2
types/mongorito/index.d.ts
vendored
2
types/mongorito/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/vadimdemedes/mongorito, https://github.com/vdemedes/mongorito
|
||||
// Definitions by: Pinguet62 <https://github.com/pinguet62>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Collection, CommonOptions, Db, IndexOptions, Long, MongoClientOptions, ReadPreference } from 'mongodb';
|
||||
|
||||
|
||||
2
types/mongration/index.d.ts
vendored
2
types/mongration/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/awapps/mongration#readme
|
||||
// Definitions by: Anton Lobashev <https://github.com/soulthreads>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Db } from 'mongodb';
|
||||
|
||||
|
||||
2
types/multer-gridfs-storage/v1/index.d.ts
vendored
2
types/multer-gridfs-storage/v1/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/devconcept/multer-gridfs-storage
|
||||
// Definitions by: devconcept <https://github.com/devconcept>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Express } from 'express';
|
||||
|
||||
2
types/multer-gridfs-storage/v2/index.d.ts
vendored
2
types/multer-gridfs-storage/v2/index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/devconcept/multer-gridfs-storage
|
||||
// Definitions by: devconcept <https://github.com/devconcept>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Express } from 'express';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user