KubesK
tRPC17mo ago
Kubes

Mongo Db Schema _id(ObjectId) in trpc get serializes to string

Hello there,
In the mongoDB schema there is _id field with the type of ObjectId. But during serilization from trpc on the server its get converted to a string type.

On the client the Mongo DB type gives a error that the _id type is string and not ObjectId.

Similar Issues I found.
https://github.com/trpc/trpc/issues/4138

I tried to setup transformers but there seems to be no documentation on how to create a custom transformer.
Only the interface definition is given.

Are there any custom transformers example ?

Are there any docs explaining when and how transforms fit in the trpc send and recv pipeline ?


PS: The superjson transformer example was not working for me.
If you need any further info let me know. I provide as much as I can.
The repo with the problem is private.
Was this page helpful?