1
0
Fork 0
mirror of synced 2024-06-14 00:14:39 +12:00

Null pointer fix

This commit is contained in:
Mel O'Hagan 2022-05-13 15:07:26 +01:00 committed by mike12345567
parent 094a548e38
commit a58f35a6cd

View file

@ -91,7 +91,9 @@ module MongoDBModule {
json[field] = self.createObjectIds(json[field])
}
if (field === "_id") {
const id = json["_id"].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)[0]
const id = json["_id"].match(
/(?<=objectid\(['"]).*(?=['"]\))/gi
)?.[0]
if (id) {
json["_id"] = new ObjectID.createFromHexString(id)
}