bson: add cacheHexString boolean flag to ObjectID

This commit is contained in:
arusakov
2018-02-27 16:17:17 +03:00
parent 62c721de25
commit fd0ba37df7
2 changed files with 7 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
import * as bson from 'bson';
// enable hex string caching
bson.ObjectID.cacheHexString = true
let BSON = new bson.BSON();
let Long = bson.Long;

View File

@@ -135,6 +135,10 @@ export class ObjectID {
constructor(id?: string | number | ObjectID);
/** The generation time of this ObjectID instance */
generationTime: number;
/**
* If true cache the hex string representation of ObjectID instance
*/
static cacheHexString?: boolean;
/**
* Creates an ObjectID from a hex string representation of an ObjectID.
* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring.