From fd0ba37df78fffc857c6b36df7205a445488ee11 Mon Sep 17 00:00:00 2001 From: arusakov Date: Tue, 27 Feb 2018 16:17:17 +0300 Subject: [PATCH] bson: add cacheHexString boolean flag to ObjectID --- types/bson/bson-tests.ts | 3 +++ types/bson/index.d.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/types/bson/bson-tests.ts b/types/bson/bson-tests.ts index d18332fe9f..ebdd8a19c3 100644 --- a/types/bson/bson-tests.ts +++ b/types/bson/bson-tests.ts @@ -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; diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 380e6e380c..817f50374d 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -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.