Merge pull request #23946 from arusakov/bson-objectid-cachehexstring

bson: add cacheHexString boolean flag to ObjectID
This commit is contained in:
Benjamin Lichtman
2018-02-28 14:07:08 -08:00
committed by GitHub
2 changed files with 5 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,8 @@ 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 */
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.