From 423febb7d5a9a186846f8b83817893a5b16523f3 Mon Sep 17 00:00:00 2001 From: Lior Mualem Date: Mon, 19 May 2014 18:34:02 +0300 Subject: [PATCH 1/2] Added Binary class to mongodb. --- mongodb/mongodb.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 0805e832a..01b31e538 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -129,6 +129,26 @@ declare module "mongodb" { public static createFromHexString(hexString: string): ObjectID; } + // Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/binary.html + export class Binary { + constructor (buffer: Buffer, subType?: number); + + // Updates this binary with byte_value + put(byte_value: any): void; + + // Writes a buffer or string to the binary + write(buffer: any, offset: number): void; + + // Reads length bytes starting at position. + read(position: number, length: number): Buffer; + + // Returns the value of this binary as a string. + value(): string; + + // The length of the binary. + length(): number; + } + export interface SocketOptions { //= set seconds before connection times out default:0 timeout?: number; From 150bb126d3e70789d735243dc676a4cc2e71827a Mon Sep 17 00:00:00 2001 From: Lior Mualem Date: Tue, 20 May 2014 08:05:22 +0300 Subject: [PATCH 2/2] Added createIndex and ensureIndex overloads to mongodb.Collection. --- mongodb/mongodb.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 01b31e538..05f71d20a 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -302,8 +302,12 @@ declare module "mongodb" { findOne(selector: Object, fields: any, skip: number, limit: number, callback?: (err: Error, result: any) => void): Cursor; findOne(selector: Object, fields: any, skip: number, limit: number, timeout: number, callback?: (err: Error, result: any) => void): Cursor; + createIndex(fieldOrSpec: any, callback: (err: Error, indexName: string) => void): void; createIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void): void; + + ensureIndex(fieldOrSpec: any, callback: (err: Error, indexName: string) => void): void; ensureIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void): void; + indexInformation(options: any, callback: Function): void; dropIndex(name: string, callback: Function): void; dropAllIndexes(callback: Function): void;