Marc J. Schmidt
Marc J. Schmidt
I understand now, thanks. One of Marshal's fundamental concepts is that classes should be agnostic to its serialization targets. Having an `ObjectId` as property type tightly couples this class to...
The naming strategy feature would reduce the use-case example down to this: ```typescript import { f } from '@marcj/marshal'; import { mongoToPlain } from '@marcj/marshal-mongo'; @Entity('user') class User { @f.mongoId().named('mongo',...
I'd not expect to have any MongoDB driver special types (Binary, ObjectId, UUID,...) in my typescript class. This is again against the philosophie of Marshal (and OR*M principles). You can...
Yeah, I see the use-case for backend/NodeJS-only serializer/db abstractions. But Marshal is an universal serializer/db abstraction which allows you to use the same class at frontend, cli, shared libraries etc...
> We tried, but just didn't scale Yeah because you didn't have Marshal. I tried as well and failed, that's why I created Marshal. > Only simple use-cases would work...
Yeah, I tried code generators as well, but it's not a joy. GraphQL neither. Deepkit has about 75 models and none is duplicated. I agree that not caring about compatibility...
You probably need a library like `dot-prop` if you have deep patches, if not a simple assignment will do it. ```typescript import {set} from 'dot-prop'; import {partialPlainToClass} from '@marcj/marshal'; const...
If you need a copy of the class instance, use `cloneClass` before. If you want to maintain unchanged references use [`applyPatch`](https://github.com/marcj/marshal.ts#patch--state-management-ngrx-etc--frozen-objects) > change any properties (nested, in arrays, etc), then...
```typescript test('patch2', () => { class User { @f firstName!: string; @f lastName!: string; @f updated!: Date; } const user = new User(); user.firstName = 'John'; user.lastName = 'Doe'; user.updated...
> Maybe use json patch style and a "json patch to mongo update" type of utility function for consumers. JSON patch is incompatible with mongo's patch system (JSON patch is...