Hi! I have a little problem you might be able to h...
# mongodb
m
Hi! I have a little problem you might be able to help me with 🙂 We are currently building a PoC and are trying to decide on whether to use prisma or mongoose for our application. Personally I'm leaning heavily towards Prisma since I have only good experiences with it in projects that use SQL databases. However, I have a little problem currently. For context: We are building a microservice that needs to consume messages from a rabbitmq. Those messages originate from many different sources within our company (other microservices, e-commerce applications, ERP, ...) and have a fixed structure. However, we can not guarantee that every message is schematically correct. There might be outdated or not-yet-supported fields in the message etc. Now, in order to being able to reproduce scenarios, we need to save those messages in mongoDB for at least 3 months. When I try and save a "malformed" message via Prisma, I get an error (unknown arg for example). Mongoose would just save those additional fields, no questions asked. Now, I know that this is by design, but is there any way to let prisma just ignore the circumstance that a DTO contains unknown fields and save it nonetheless?
d
You can store the entire message as JSON.
m
Yeah I know, we still need some kind of type-safety.
We use a different approach now by storing "raw" messages in a separate collection via JSON field, then parsing it and storing the parsed data in a separate collection along with a relation to the raw message.
j
What kind of type safety are you after then? For the core, known attributes of the data?