This commit is contained in:
Mel O'Hagan 2022-07-26 11:38:34 +01:00
parent 377aca0458
commit 0ead7fca54
1 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,10 @@ module MongoDBModule {
if (json[field] instanceof Object) {
json[field] = self.createObjectIds(json[field])
}
if ((field === "_id" || field?.startsWith("$")) && typeof json[field] === "string") {
if (
(field === "_id" || field?.startsWith("$")) &&
typeof json[field] === "string"
) {
const id = json[field].match(
/(?<=objectid\(['"]).*(?=['"]\))/gi
)?.[0]