Updated expandObjectIds function in utils.js to convert _id values to strings, ensuring consistent data formatting for object IDs.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-07-18 16:28:25 +01:00
parent e112ec4386
commit e5981ce419

View File

@ -1059,7 +1059,7 @@ function expandObjectIds(input) {
for (const [key, val] of Object.entries(value)) { for (const [key, val] of Object.entries(value)) {
if (key === '_id') { if (key === '_id') {
// Do not expand keys that are already named _id // Do not expand keys that are already named _id
result[key] = val; result[key] = val.toString();
} else if (isObjectId(val)) { } else if (isObjectId(val)) {
result[key] = { _id: val }; result[key] = { _id: val };
} else if (Array.isArray(val)) { } else if (Array.isArray(val)) {