From 9deaae7c3a4945c35e7c12f4de7a60fac69e5eb5 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 10:23:44 +0200 Subject: [PATCH 1/6] Add mongodb from 'soywiz/typescript-node-definitions' --- mongodb/mongodb.d.ts | 305 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 mongodb/mongodb.d.ts diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts new file mode 100644 index 0000000000..dcd8291690 --- /dev/null +++ b/mongodb/mongodb.d.ts @@ -0,0 +1,305 @@ +/// + +declare module "mongodb" { + + export function connect(uri: string, options: any, callback: (err: any, db: Db) => void); + export function connect(uri: string, callback: (err: any, db: Db) => void); + + export class Server { + constructor (host: string, port: number, opts?: ServerOptions); + } + export class Db { + constructor (databaseName: string, serverConfig: Server, db_options?: DBOptions); + + public db(dbName: string): Db; + + public open(callback: (err : Error, db : Db) => void ); + public close(forceClose?: bool, callback?: (err: any, result: any) => void ); + public admin(callback: (err, result) => void ): any; + public collectionsInfo(collectionName: string, callback?: (err, result) => void ); + public collectionNames(collectionName: string, options: any, callback?: (err, result) => void ); + + public collection(collectionName: string): Collection; + public collection(collectionName: string, callback: (err: any, collection: Collection) => void ): Collection; + public collection(collectionName: string, options: MongoCollectionOptions, callback: (err: any, collection: Collection) => void ): Collection; + + public collections(callback: (err: any, collections: Collection[]) => void ); + public eval(code: any, parameters: any[], options?: any, callback?: (err, result) => void ); + //public dereference(dbRef: DbRef, callback: (err, result) => void); + + public logout(options: any, callback?: (err, result) => void ); + public logout(callback: (err, result) => void ); + + public authenticate(userName: string, password: string, callback?: (err, result) => void ); + public authenticate(userName: string, password: string, options: any, callback?: (err, result) => void ); + + public addUser(username: string, password: string, callback?: (err, result) => void ); + public addUser(username: string, password: string, options: any, callback?: (err, result) => void ); + + public removeUser(username: string, callback?: (err, result) => void ); + public removeUser(username: string, options: any, callback?: (err, result) => void ); + + public createCollection(collectionName: string, callback?: (err: Error, result: Collection) => void ); + public createCollection(collectionName: string, options: CollectionCreateOptions, callback?: (err, result) => void ); + + public command(selector: any, callback?: (err, result) => void ); + public command(selector: any, options: any, callback?: (err, result) => void ); + + public dropCollection(collectionName: string, callback?: (err, result) => void ); + public renameCollection(fromCollection: string, toCollection: string, callback?: (err, result) => void ); + + public lastError(options, connectionOptions, callback: (err, result) => void ); + public previousError(options, callback: (err, result) => void ); + + // error = lastError + // lastStatus = lastError + + public executeDbCommand(command_hash, callback?: (err, result) => void ); + public executeDbCommand(command_hash, options, callback?: (err, result) => void ); + + public executeDbAdminCommand(command_hash, callback?: (err, result) => void ); + public executeDbAdminCommand(command_hash, options, callback?: (err, result) => void ); + + public resetErrorHistory(callback?: (err, result) => void ); + public resetErrorHistory(options, callback?: (err, result) => void ); + + public createIndex(collectionName, fieldOrSpec, options, callback); + public ensureIndex(collectionName, fieldOrSpec, options, callback); + + public cursorInfo(options, callback); + + public dropIndex(collectionName, indexName, callback); + public reIndex(collectionName, callback); + public indexInformation(collectionName, options, callback); + public dropDatabase(callback: (err, result) => void ); + + public stats(options, callback); + public _registerHandler(db_command, raw, connection, exhaust, callback); + public _reRegisterHandler(newId, object, callback); + public _callHandler(id, document, err); + public _hasHandler(id); + public _removeHandler(id); + public _findHandler(id): { id: string; callback: Function; }; + public __executeQueryCommand(self, db_command, options, callback); + + public DEFAULT_URL: string; + + public connect(url: string, options: { uri_decode_auth?: bool; }, callback: (err, result) => void ); + + public addListener(event: string, handler:(param: any) => any); + } + + export class ObjectID { + constructor (s: string); + } + + export interface SocketOptions { + //= set seconds before connection times out default:0 + timeout?: number; + //= Disables the Nagle algorithm default:true + noDelay?: bool; + //= Set if keepAlive is used default:0 , which means no keepAlive, set higher than 0 for keepAlive + keepAlive?: number; + //= ‘ascii’|’utf8’|’base64’ default:null + encoding?: string; + } + + export interface ServerOptions { + // - to reconnect automatically, default:false + auto_reconnect?: bool; + // - specify the number of connections in the pool default:1 + poolSize?: number; + // - a collection of pr socket settings + socketOptions?: any; + } + + export interface PKFactory { + counter: number; + createPk: () => number; + } + + export interface DBOptions { + //- if true, use native BSON parser + native_parser?: bool; + //- sets strict mode , if true then existing collections can’t be “recreated” etc. + strict?: bool; + //- custom primary key factory to generate _id values (see Custom primary keys). + pk?: PKFactory; + //- generation of objectid is delegated to the mongodb server instead of the driver. default is false + forceServerObjectId?: bool; + //- specify the number of milliseconds between connection attempts default:5000 + retryMiliSeconds?: number; + //- specify the number of retries for connection attempts default:3 + numberOfRetries?: number; + //- enable/disable reaper (true/false) default:false + reaper?: bool; + //- specify the number of milliseconds between each reaper attempt default:10000 + reaperInterval?: number; + //- specify the number of milliseconds for timing out callbacks that don’t return default:30000 + reaperTimeout?: number; + //- driver expects Buffer raw bson document, default:false + raw?: bool; + } + + export interface CollectionCreateOptions { + // {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. + safe?: bool; + // {Boolean, default:false}, serialize functions on the document. + serializeFunctions?: bool; + // {Boolean, default:false}, perform all operations using raw bson objects. + raw?: bool; + // object overriding the basic ObjectID primary key generation. + pkFactory?: PKFactory; + // {Boolean, default:false}, create a capped collection. + capped?: bool; + // {Number}, the size of the capped collection in bytes. + size?: number; + // {Number}, the maximum number of documents in the capped collection. + max?: number; + // {Boolean, default:false}, create an index on the _id field of the document, not created automatically on capped collections. + autoIndexId?: bool; + // {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). + readPreference?: string; + } + + export interface Collection { + //constructor (db: Db, collectionName: string, pkFactory, options); + + insert(query: any, callback: (err: any, result: any) => void): void; + insert(query: any, options: { safe?: any; continueOnError?: bool; keepGoing?: bool; serializeFunctions?: bool; }, callback: (err: any, result: any) => void): void; + + remove(selector, callback?: (err: any, result: any) => void); + remove(selector, options: { safe?: any; single?: bool; }, callback?: (err: any, result: any) => void); + + rename(newName: String, callback?: (err, result) => void); + + save(doc: any, callback : (err, result) => void); + save(doc: any, options: { safe: any; }, callback : (err, result) => void); + + update(selector: any, document: any, callback?: (err: any, result: any) => void): void; + update(selector: any, document: any, options: { safe?; upsert?; multi?; serializeFunctions?; }, callback: (err: any, result: any) => void): void; + + distinct(key: string, query: Object, callback: (err, result) => void); + distinct(key: string, query: Object, options: { readPreferences; }, callback: (err, result) => void); + + count(callback: (err, result) => void); + count(query: Object, callback: (err, result) => void); + count(query: Object, options: { readPreferences; }, callback: (err, result) => void); + + drop(callback?: (err, result) => void); + + findAndModify(query: Object, sort: any[], doc: Object, callback: (err, result) => void); + findAndModify(query: Object, sort: any[], doc: Object, options: { safe?: any; remove?: bool; upsert?: bool; new?: bool; }, callback: (err, result) => void); + + findAndRemove(query : Object, sort? : any[], callback?: (err, result) => void); + findAndRemove(query : Object, sort? : any[], options?: { safe; }, callback?: (err, result) => void); + + find(callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, fields: any, callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, options: CollectionFindOptions, callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: Cursor) => void): Cursor; + find(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: Cursor) => void): Cursor; + + findOne(callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: any) => void): Cursor; + + createIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void); + ensureIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void); + indexInformation(options, callback); + dropIndex(name, callback); + dropAllIndexes(callback); + // dropIndexes = dropAllIndexes + + reIndex(callback); + mapReduce(map, reduce, options, callback); + group(keys, condition, initial, reduce, finalize, command, options, callback); + options(callback); + isCapped(callback); + indexExists(indexes, callback); + geoNear(x, y, options, callback); + geoHaystackSearch(x, y, options, callback); + indexes(callback); + aggregate(pipeline: any[], callback: (err: Error, results: any) => void); + aggregate(pipeline: any[], options, callback: (err: Error, results: any) => void); + stats(options, callback); + + hint; + } + + export interface IndexOptions { + background?: bool; + dropDups?: bool; + sparse?: bool; + unique?: bool; + v?: number; + } + + export class Cursor { + constructor (db, collection, selector, fields, skip, limit, sort, hint, explain, snapshot, timeout, tailable, batchSize, slaveOk, raw, read, returnKey, maxScan, min, max, showDiskLoc, comment, awaitdata, numberOfRetries, dbName, tailableRetryInterval, exhaust, partial); + + rewind() : Cursor; + toArray(callback: (err: any, results: any[]) => any) : void; + each(callback: (err: Error, item: any) => void) : void; + count(callback: (err: any, count: number) => void) : void; + + sort(keyOrList : any, callback? : (err, result) => void): Cursor; + sort(keyOrList : String, direction : any, callback? : (err, result) => void): Cursor; + + limit(limit: number, callback?: (err, result) => void): Cursor; + setReadPreference(readPreferences, tags, callback?): Cursor; + skip(skip: number, callback?: (err, result) => void): Cursor; + batchSize(batchSize, callback: (err, result) => void): Cursor; + + nextObject(callback: (err:any, doc: any) => void); + explain(callback: (err, result) => void); + //stream(): CursorStream; + + close(callback?: (err, result) => void); + isClosed(): Boolean; + + static INIT; + static OPEN; + static CLOSED; + } + + export interface CollectionFindOptions { + limit?; + sort?; + fields?; + skip?; + hint?; + explain?; + snapshot?; + timeout?; + tailtable?; + tailableRetryInterval?; + numberOfRetries?; + awaitdata?; + exhaust?; + batchSize?; + returnKey?; + maxScan?; + min?; + max?; + showDiskLoc?; + comment?; + raw?; + readPreferences?; + partial?; + } + + export interface MongoCollectionOptions { + safe?: any; + serializeFunctions?: any; + raw?: bool; + pkFactory?: any; + readPreferences?: string; + } +} From 215d4a45544b411a6068077113de1ca4639a69ec Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 10:24:36 +0200 Subject: [PATCH 2/6] Fix node.d.ts reference --- mongodb/mongodb.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index dcd8291690..c7c614c691 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -1,4 +1,4 @@ -/// +/// declare module "mongodb" { From 97bfae1766d76b223bc2d0b6d7a5b990f0f82a2b Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 10:25:27 +0200 Subject: [PATCH 3/6] Change bool to boolean --- mongodb/mongodb.d.ts | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index c7c614c691..936b77160d 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -14,7 +14,7 @@ declare module "mongodb" { public db(dbName: string): Db; public open(callback: (err : Error, db : Db) => void ); - public close(forceClose?: bool, callback?: (err: any, result: any) => void ); + public close(forceClose?: boolean, callback?: (err: any, result: any) => void ); public admin(callback: (err, result) => void ): any; public collectionsInfo(collectionName: string, callback?: (err, result) => void ); public collectionNames(collectionName: string, options: any, callback?: (err, result) => void ); @@ -84,7 +84,7 @@ declare module "mongodb" { public DEFAULT_URL: string; - public connect(url: string, options: { uri_decode_auth?: bool; }, callback: (err, result) => void ); + public connect(url: string, options: { uri_decode_auth?: boolean; }, callback: (err, result) => void ); public addListener(event: string, handler:(param: any) => any); } @@ -97,7 +97,7 @@ declare module "mongodb" { //= set seconds before connection times out default:0 timeout?: number; //= Disables the Nagle algorithm default:true - noDelay?: bool; + noDelay?: boolean; //= Set if keepAlive is used default:0 , which means no keepAlive, set higher than 0 for keepAlive keepAlive?: number; //= ‘ascii’|’utf8’|’base64’ default:null @@ -106,7 +106,7 @@ declare module "mongodb" { export interface ServerOptions { // - to reconnect automatically, default:false - auto_reconnect?: bool; + auto_reconnect?: boolean; // - specify the number of connections in the pool default:1 poolSize?: number; // - a collection of pr socket settings @@ -120,44 +120,44 @@ declare module "mongodb" { export interface DBOptions { //- if true, use native BSON parser - native_parser?: bool; + native_parser?: boolean; //- sets strict mode , if true then existing collections can’t be “recreated” etc. - strict?: bool; + strict?: boolean; //- custom primary key factory to generate _id values (see Custom primary keys). pk?: PKFactory; //- generation of objectid is delegated to the mongodb server instead of the driver. default is false - forceServerObjectId?: bool; + forceServerObjectId?: boolean; //- specify the number of milliseconds between connection attempts default:5000 retryMiliSeconds?: number; //- specify the number of retries for connection attempts default:3 numberOfRetries?: number; //- enable/disable reaper (true/false) default:false - reaper?: bool; + reaper?: boolean; //- specify the number of milliseconds between each reaper attempt default:10000 reaperInterval?: number; //- specify the number of milliseconds for timing out callbacks that don’t return default:30000 reaperTimeout?: number; //- driver expects Buffer raw bson document, default:false - raw?: bool; + raw?: boolean; } export interface CollectionCreateOptions { // {true | {w:n, wtimeout:n} | {fsync:true}, default:false}, executes with a getLastError command returning the results of the command on MongoDB. - safe?: bool; + safe?: boolean; // {Boolean, default:false}, serialize functions on the document. - serializeFunctions?: bool; + serializeFunctions?: boolean; // {Boolean, default:false}, perform all operations using raw bson objects. - raw?: bool; + raw?: boolean; // object overriding the basic ObjectID primary key generation. pkFactory?: PKFactory; // {Boolean, default:false}, create a capped collection. - capped?: bool; + capped?: boolean; // {Number}, the size of the capped collection in bytes. size?: number; // {Number}, the maximum number of documents in the capped collection. max?: number; // {Boolean, default:false}, create an index on the _id field of the document, not created automatically on capped collections. - autoIndexId?: bool; + autoIndexId?: boolean; // {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). readPreference?: string; } @@ -166,10 +166,10 @@ declare module "mongodb" { //constructor (db: Db, collectionName: string, pkFactory, options); insert(query: any, callback: (err: any, result: any) => void): void; - insert(query: any, options: { safe?: any; continueOnError?: bool; keepGoing?: bool; serializeFunctions?: bool; }, callback: (err: any, result: any) => void): void; + insert(query: any, options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }, callback: (err: any, result: any) => void): void; remove(selector, callback?: (err: any, result: any) => void); - remove(selector, options: { safe?: any; single?: bool; }, callback?: (err: any, result: any) => void); + remove(selector, options: { safe?: any; single?: boolean; }, callback?: (err: any, result: any) => void); rename(newName: String, callback?: (err, result) => void); @@ -189,7 +189,7 @@ declare module "mongodb" { drop(callback?: (err, result) => void); findAndModify(query: Object, sort: any[], doc: Object, callback: (err, result) => void); - findAndModify(query: Object, sort: any[], doc: Object, options: { safe?: any; remove?: bool; upsert?: bool; new?: bool; }, callback: (err, result) => void); + findAndModify(query: Object, sort: any[], doc: Object, options: { safe?: any; remove?: boolean; upsert?: boolean; new?: boolean; }, callback: (err, result) => void); findAndRemove(query : Object, sort? : any[], callback?: (err, result) => void); findAndRemove(query : Object, sort? : any[], options?: { safe; }, callback?: (err, result) => void); @@ -234,10 +234,10 @@ declare module "mongodb" { } export interface IndexOptions { - background?: bool; - dropDups?: bool; - sparse?: bool; - unique?: bool; + background?: boolean; + dropDups?: boolean; + sparse?: boolean; + unique?: boolean; v?: number; } @@ -298,7 +298,7 @@ declare module "mongodb" { export interface MongoCollectionOptions { safe?: any; serializeFunctions?: any; - raw?: bool; + raw?: boolean; pkFactory?: any; readPreferences?: string; } From c9fdedadae2cf5adc2b41c313535f592eb703166 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 10:29:28 +0200 Subject: [PATCH 4/6] Fix indentation --- mongodb/mongodb.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 936b77160d..ef9d1cd541 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -2,8 +2,8 @@ declare module "mongodb" { - export function connect(uri: string, options: any, callback: (err: any, db: Db) => void); - export function connect(uri: string, callback: (err: any, db: Db) => void); + export function connect(uri: string, options: any, callback: (err: any, db: Db) => void); + export function connect(uri: string, callback: (err: any, db: Db) => void); export class Server { constructor (host: string, port: number, opts?: ServerOptions); @@ -19,9 +19,9 @@ declare module "mongodb" { public collectionsInfo(collectionName: string, callback?: (err, result) => void ); public collectionNames(collectionName: string, options: any, callback?: (err, result) => void ); - public collection(collectionName: string): Collection; - public collection(collectionName: string, callback: (err: any, collection: Collection) => void ): Collection; - public collection(collectionName: string, options: MongoCollectionOptions, callback: (err: any, collection: Collection) => void ): Collection; + public collection(collectionName: string): Collection; + public collection(collectionName: string, callback: (err: any, collection: Collection) => void ): Collection; + public collection(collectionName: string, options: MongoCollectionOptions, callback: (err: any, collection: Collection) => void ): Collection; public collections(callback: (err: any, collections: Collection[]) => void ); public eval(code: any, parameters: any[], options?: any, callback?: (err, result) => void ); @@ -85,7 +85,7 @@ declare module "mongodb" { public DEFAULT_URL: string; public connect(url: string, options: { uri_decode_auth?: boolean; }, callback: (err, result) => void ); - + public addListener(event: string, handler:(param: any) => any); } @@ -226,8 +226,8 @@ declare module "mongodb" { geoNear(x, y, options, callback); geoHaystackSearch(x, y, options, callback); indexes(callback); - aggregate(pipeline: any[], callback: (err: Error, results: any) => void); - aggregate(pipeline: any[], options, callback: (err: Error, results: any) => void); + aggregate(pipeline: any[], callback: (err: Error, results: any) => void); + aggregate(pipeline: any[], options, callback: (err: Error, results: any) => void); stats(options, callback); hint; From d96d0a21ea0d0a5f7d7ff3b145cd08b6a0802751 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 10:39:37 +0200 Subject: [PATCH 5/6] Change db.findOne to be generic --- mongodb/mongodb.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index ef9d1cd541..74adb41db9 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -202,13 +202,13 @@ declare module "mongodb" { find(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: Cursor) => void): Cursor; find(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: Cursor) => void): Cursor; - findOne(callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, fields: any, callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: any) => void): Cursor; - findOne(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: any) => void): Cursor; + findOne(callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, fields: any, callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, options: CollectionFindOptions, callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: T) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: T) => void): Cursor; createIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void); ensureIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void); From bc564b3abd8531d35f08925af0a26a02fbbdb8fb Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Tue, 27 Aug 2013 11:52:17 +0200 Subject: [PATCH 6/6] Remove generics from findOne... lol --- mongodb/mongodb.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 74adb41db9..ef9d1cd541 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -202,13 +202,13 @@ declare module "mongodb" { find(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: Cursor) => void): Cursor; find(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: Cursor) => void): Cursor; - findOne(callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, fields: any, callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, options: CollectionFindOptions, callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: T) => void): Cursor; - findOne(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: T) => void): Cursor; + findOne(callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, options: CollectionFindOptions, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, callback?: (err: any, result: any) => void): Cursor; + findOne(selector: any, fields: any, skip: number, limit: number, timeout: number, callback?: (err: any, result: any) => void): Cursor; createIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void); ensureIndex(fieldOrSpec, options: IndexOptions, callback: (err: Error, indexName: string) => void);