From 65567e417c935ff37830995fbbb370b47b0dc1a2 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 22:53:33 +0200 Subject: [PATCH 01/15] Add class documentation links --- mongodb/mongodb.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 15791a8e5..e9177f96e 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -5,6 +5,7 @@ /// declare module "mongodb" { + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html export class MongoClient{ constructor(serverConfig: any, options: any); @@ -13,9 +14,12 @@ declare module "mongodb" { static connect(uri: string, callback: (err: any, db: Db) => void); } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html export class Server { constructor (host: string, port: number, opts?: ServerOptions); } + + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html export class Db { constructor (databaseName: string, serverConfig: Server, db_options?: DBOptions); @@ -97,6 +101,7 @@ declare module "mongodb" { public addListener(event: string, handler:(param: any) => any); } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html export class ObjectID { constructor (s: string); } From 6f67cf53914d7d0e2962c549ab5e5c75ae91bba0 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 22:54:59 +0200 Subject: [PATCH 02/15] Fix indentation --- mongodb/mongodb.d.ts | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index e9177f96e..403d3f928 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -6,20 +6,20 @@ declare module "mongodb" { - // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html - export class MongoClient{ - constructor(serverConfig: any, options: any); - - static connect(uri: string, options: any, callback: (err: any, db: Db) => void); - static connect(uri: string, callback: (err: any, db: Db) => void); - } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html + export class MongoClient{ + constructor(serverConfig: any, options: any); - // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html + static connect(uri: string, options: any, callback: (err: any, db: Db) => void); + static connect(uri: string, callback: (err: any, db: Db) => void); + } + + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html export class Server { constructor (host: string, port: number, opts?: ServerOptions); } - // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html export class Db { constructor (databaseName: string, serverConfig: Server, db_options?: DBOptions); @@ -101,7 +101,7 @@ declare module "mongodb" { public addListener(event: string, handler:(param: any) => any); } - // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html export class ObjectID { constructor (s: string); } @@ -177,36 +177,36 @@ declare module "mongodb" { 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?: 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?: boolean; }, 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?: 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); - + 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; @@ -214,7 +214,7 @@ declare module "mongodb" { 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; @@ -222,14 +222,14 @@ declare module "mongodb" { 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); @@ -242,7 +242,7 @@ declare module "mongodb" { aggregate(pipeline: any[], callback: (err: Error, results: any) => void); aggregate(pipeline: any[], options, callback: (err: Error, results: any) => void); stats(options, callback); - + hint; } @@ -315,4 +315,4 @@ declare module "mongodb" { pkFactory?: any; readPreferences?: string; } -} +} \ No newline at end of file From 20dcd7154d1420523210acac361a94b943178bae Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:02:18 +0200 Subject: [PATCH 03/15] Add connect to Server --- mongodb/mongodb.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 403d3f928..8cb521499 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -17,6 +17,8 @@ declare module "mongodb" { // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html export class Server { constructor (host: string, port: number, opts?: ServerOptions); + + public connect(); } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html From 994417b277d8ede753e8bac311632f73efcc776e Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:16:31 +0200 Subject: [PATCH 04/15] Update DBOptions --- mongodb/mongodb.d.ts | 70 ++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 8cb521499..00d74bff6 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -23,7 +23,7 @@ declare module "mongodb" { // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html export class Db { - constructor (databaseName: string, serverConfig: Server, db_options?: DBOptions); + constructor (databaseName: string, serverConfig: Server, dbOptions?: DBOptions); public db(dbName: string): Db; @@ -133,27 +133,61 @@ declare module "mongodb" { createPk: () => number; } + // See : http://mongodb.github.io/node-mongodb-native/api-generated/db.html export interface DBOptions { - //- if true, use native BSON parser + // the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = ‘majority’ or tag acknowledges the write. + w?: string; + + // set the timeout for waiting for write concern to finish (combines with w option). + wtimeout?: number; + + // write waits for fsync before returning. default:false. + fsync?: boolean; + + // write waits for journal sync before returning. default:false. + journal?: boolean; + + readPreference?: string; + + // use c++ bson parser. default:false. native_parser?: boolean; - //- sets strict mode , if true then existing collections can’t be “recreated” etc. - 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 + + // force server to create _id fields instead of client. default:false. 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?: 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 + + // custom primary key factory to generate _id values (see Custom primary keys). + pkFactory?: PKFactory; + + // serialize functions. default:false. + serializeFunctions?: boolean; + + // peform operations using raw bson buffers. default:false. raw?: boolean; + + // record query statistics during execution. default:false. + recordQueryStats?: boolean; + + // number of miliseconds between retries. default:5000. + retryMiliSeconds?: number; + + // number of retries off connection. default:5. + numberOfRetries?: number; + + // an object representing a logger that you want to use, needs to support functions debug, log, error. default:null. + logger?: Object + + // force setting of SlaveOk flag on queries (only use when explicitly connecting to a secondary server). default:null. + slaveOk?: number; + + // when deserializing a Long will fit it into a Number if it’s smaller than 53 bits. default:true. + promoteLongs?: boolean; + + // enable/disable reaper (true/false) default:false + 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; } export interface CollectionCreateOptions { From 2a85e74df1c5a5ed175a17eae19de5c955117b87 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:17:04 +0200 Subject: [PATCH 05/15] Remove reaper from DBOptions --- mongodb/mongodb.d.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 00d74bff6..d0257ad53 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -181,13 +181,6 @@ declare module "mongodb" { // when deserializing a Long will fit it into a Number if it’s smaller than 53 bits. default:true. promoteLongs?: boolean; - - // enable/disable reaper (true/false) default:false - 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; } export interface CollectionCreateOptions { From 1aef8d9bb3bde5229031054c313667ddb6684ece Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:28:16 +0200 Subject: [PATCH 06/15] Add ReadPreference class --- mongodb/mongodb.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index d0257ad53..303ec5899 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -134,6 +134,7 @@ declare module "mongodb" { } // See : http://mongodb.github.io/node-mongodb-native/api-generated/db.html + // Current definition by documentation version 1.3.13 (28.08.2013) export interface DBOptions { // the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = ‘majority’ or tag acknowledges the write. w?: string; @@ -147,6 +148,7 @@ declare module "mongodb" { // write waits for journal sync before returning. default:false. journal?: boolean; + // the prefered read preference. use 'ReadPreference' class. readPreference?: string; // use c++ bson parser. default:false. @@ -183,6 +185,14 @@ declare module "mongodb" { promoteLongs?: boolean; } + export class ReadPreference { + public static PRIMARY: string; + public static PRIMARY_PREFERRED: string; + public static SECONDARY: string; + public static SECONDARY_PREFERRED: string; + public static NEAREST: string; + } + 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?: boolean; From 79808dd87f15b60d0f6300648b2983641000fb2d Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:30:26 +0200 Subject: [PATCH 07/15] Update Collection constructor --- 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 303ec5899..200c5cede 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -215,7 +215,7 @@ declare module "mongodb" { } export interface Collection { - //constructor (db: Db, collectionName: string, pkFactory, options); + constructor (db: Db, collectionName: string, pkFactory?: Object, options?: CollectionCreateOptions); insert(query: any, 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; From ffac14f3a36151154d0f5a90da33277a4acec172 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:40:38 +0200 Subject: [PATCH 08/15] Update ObjectID class --- mongodb/mongodb.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 200c5cede..2650d7e46 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -104,8 +104,26 @@ declare module "mongodb" { } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html + // Last update: doc. version 1.3.13 (28.08.2013) export class ObjectID { constructor (s: string); + + // Returns the ObjectID id as a 24 byte hex string representation + public toHexString() : string; + + // Compares the equality of this ObjectID with otherID. + public equals(otherID: ObjectID) : boolean; + + // Returns the generation date (accurate up to the second) that this ID was generated. + public getTimestamp(): Date; + + // Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. + // time – an integer number representing a number of seconds. + public static createFromTime(time: number): ObjectID; + + // Creates an ObjectID from a hex string representation of an ObjectID. + // hexString – create a ObjectID from a passed in 24 byte hexstring. + public static createFromHexString(hexString: string): ObjectID; } export interface SocketOptions { @@ -214,6 +232,7 @@ declare module "mongodb" { readPreference?: string; } + // Documentation : http://mongodb.github.io/node-mongodb-native/api-generated/collection.html export interface Collection { constructor (db: Db, collectionName: string, pkFactory?: Object, options?: CollectionCreateOptions); From 5c32d4aadbd655b43e8bcf9f373c7266e910b187 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Wed, 28 Aug 2013 23:55:14 +0200 Subject: [PATCH 09/15] Add name to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 811b1c534..825e9cd79 100755 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ List of Definitions * [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) * [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/)) * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) +* [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee)) * [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz)) * [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov)) * [Node.js](http://nodejs.org/) (from TypeScript samples) From 4f4de5f25f3ce35449f61a3a32396871e36cc46a Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:09:31 +0200 Subject: [PATCH 10/15] Update CollectionCreateOptions --- mongodb/mongodb.d.ts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 2650d7e46..444ae662a 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -211,25 +211,23 @@ declare module "mongodb" { public static NEAREST: string; } + // See : http://mongodb.github.io/node-mongodb-native/api-generated/collection.html + // Current definition by documentation version 1.3.13 (28.08.2013) 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?: boolean; - // {Boolean, default:false}, serialize functions on the document. + // the prefered read preference. use 'ReadPreference' class. + readPreference?: string; + + // Allow reads from secondaries. default:false. + slaveOk?: boolean; + + // serialize functions on the document. default:false. serializeFunctions?: boolean; - // {Boolean, default:false}, perform all operations using raw bson objects. + + // perform all operations using raw bson objects. default:false. raw?: boolean; + // object overriding the basic ObjectID primary key generation. pkFactory?: PKFactory; - // {Boolean, default:false}, create a capped collection. - 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?: boolean; - // {String}, the prefered read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - readPreference?: string; } // Documentation : http://mongodb.github.io/node-mongodb-native/api-generated/collection.html From 28ea779c1d69f425c12d0cbeaac773bbebec18c5 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:10:12 +0200 Subject: [PATCH 11/15] Rename DBOptions -> DbCreateOptions --- mongodb/mongodb.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 444ae662a..23ecc33d7 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -23,7 +23,7 @@ declare module "mongodb" { // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html export class Db { - constructor (databaseName: string, serverConfig: Server, dbOptions?: DBOptions); + constructor (databaseName: string, serverConfig: Server, dbOptions?: DbCreateOptions); public db(dbName: string): Db; @@ -153,7 +153,7 @@ declare module "mongodb" { // See : http://mongodb.github.io/node-mongodb-native/api-generated/db.html // Current definition by documentation version 1.3.13 (28.08.2013) - export interface DBOptions { + export interface DbCreateOptions { // the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = ‘majority’ or tag acknowledges the write. w?: string; From 046d38708117cb2bb675ab81ae16b21ed4393cdc Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:19:54 +0200 Subject: [PATCH 12/15] Update Cursor --- mongodb/mongodb.d.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 23ecc33d7..1cc6f5359 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -310,28 +310,33 @@ declare module "mongodb" { v?: number; } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html + // Last update: doc. version 1.3.13 (28.08.2013) 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); + constructor (db: Db, collection: 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; + count(applySkipLimit: boolean, 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; + sort(keyOrList: any, callback? : (err, result) => void): Cursor; + // this determines how the results are sorted. "asc", "ascending" or 1 for asceding order while "desc", "desceding or -1 for descending order. Note that the strings are case insensitive. + sort(keyOrList: String, direction : string, callback : (err, result) => void): Cursor; limit(limit: number, callback?: (err, result) => void): Cursor; - setReadPreference(readPreferences, tags, callback?): Cursor; + setReadPreference(preference: string, callback?): Cursor; skip(skip: number, callback?: (err, result) => void): Cursor; - batchSize(batchSize, callback: (err, result) => void): Cursor; + batchSize(batchSize, callback?: (err, result) => void): Cursor; - nextObject(callback: (err:any, doc: any) => void); - explain(callback: (err, result) => void); + nextObject(callback: (err: any, doc: any) => void) : void; + explain(callback: (err, result) => void) : void; + + // TODO: //stream(): CursorStream; - close(callback?: (err, result) => void); - isClosed(): Boolean; + close(callback: (err, result) => void) : void; + isClosed(): boolean; static INIT; static OPEN; From 50bfbea725dec8dc89e845e6ca6f9a2e64b31697 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:20:51 +0200 Subject: [PATCH 13/15] Update Cursor constants --- mongodb/mongodb.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 1cc6f5359..35eea5bac 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -338,9 +338,10 @@ declare module "mongodb" { close(callback: (err, result) => void) : void; isClosed(): boolean; - static INIT; - static OPEN; - static CLOSED; + public static INIT: number; + public static OPEN: number; + public static CLOSED: number; + public static GET_MORE: number; } export interface CollectionFindOptions { From 4bbd0c202aea849470ad7c85df467fc6dfa3dcc4 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:26:47 +0200 Subject: [PATCH 14/15] Remove Cursor constructor - 'INTERNAL TYPE' --- mongodb/mongodb.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 35eea5bac..8f9f03348 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -313,7 +313,9 @@ declare module "mongodb" { // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html // Last update: doc. version 1.3.13 (28.08.2013) export class Cursor { - constructor (db: Db, collection: 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); + // INTERNAL TYPE + // constructor (db: Db, collection: 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); + // constructor(db: Db, collection: Collection, selector, fields, options) rewind() : Cursor; toArray(callback: (err: any, results: any[]) => any) : void; From b668ec8e0705d6daac5f7f969750cd12e896a338 Mon Sep 17 00:00:00 2001 From: nikeee13 Date: Thu, 29 Aug 2013 00:29:03 +0200 Subject: [PATCH 15/15] Add CursorStream --- mongodb/mongodb.d.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 8f9f03348..31675c366 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -311,11 +311,11 @@ declare module "mongodb" { } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html - // Last update: doc. version 1.3.13 (28.08.2013) + // Last update: doc. version 1.3.13 (29.08.2013) export class Cursor { // INTERNAL TYPE // constructor (db: Db, collection: 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); - // constructor(db: Db, collection: Collection, selector, fields, options) + // constructor(db: Db, collection: Collection, selector, fields, options); rewind() : Cursor; toArray(callback: (err: any, results: any[]) => any) : void; @@ -334,8 +334,7 @@ declare module "mongodb" { nextObject(callback: (err: any, doc: any) => void) : void; explain(callback: (err, result) => void) : void; - // TODO: - //stream(): CursorStream; + stream(): CursorStream; close(callback: (err, result) => void) : void; isClosed(): boolean; @@ -346,6 +345,16 @@ declare module "mongodb" { public static GET_MORE: number; } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/cursorstream.html + // Last update: doc. version 1.3.13 (29.08.2013) + export class CursorStream { + constructor(cursor: Cursor); + + public pause(); + public resume(); + public destroy(); + } + export interface CollectionFindOptions { limit?; sort?;