Marks customer transform rewrites nested _id fields to customerId #1064

Closed
opened 2026-08-13 06:02:46 +00:00 by spikerj · 1 comment
Owner

transformMongoCustomer maps every _id field to customerId whenever the object does not already have customerId, including nested documents.

A payload like { _id: "c1", Meta: { _id: "inner", Label: "x" } } becomes { customerId: "c1", meta: { customerId: "inner", label: "x" } }. Nested Mongo ids (subdocuments, array items) should stay _id (or be left alone); only the root customer document should promote _id → customerId.

toCamelCase("_id") exists but is unreachable for these keys because the _id branch continues first.

Seen in projects/spikersoft/src/app/_services/marks-site/marks-customer/marks-customer.service.ts.

`transformMongoCustomer` maps every `_id` field to `customerId` whenever the object does not already have `customerId`, including nested documents. A payload like `{ _id: "c1", Meta: { _id: "inner", Label: "x" } }` becomes `{ customerId: "c1", meta: { customerId: "inner", label: "x" } }`. Nested Mongo ids (subdocuments, array items) should stay `_id` (or be left alone); only the root customer document should promote `_id` → `customerId`. `toCamelCase("_id")` exists but is unreachable for these keys because the `_id` branch `continue`s first. Seen in `projects/spikersoft/src/app/_services/marks-site/marks-customer/marks-customer.service.ts`.
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.