3 ms·
Because we had data that fit better in a non relational store. We stored data that created from user generated forms and we loaded data back into those forms.
by scarface74 7y ago
Because we had data that fit better in a non relational store. We stored data that created from user generated forms and we loaded data back into those forms.
Why use a relational store? If you’re working with a system that will only be read and written by an object based language? Why keep converting back and forth between a relational model and an object oriented model?
In C#
var seniorMales = from c in context.Customers
where c.Age > 65 && c.Sex == “M”
Would be translated at runtime to either MongoQuery, Sql, a foreach loop, etc depending on what “context” represented.
You get autocomplete and compile time checks.
When you want to add an record to your Mongo collection, you work with strongly typed
IMongoCollection<Customer>
And the compiler will ensure that your collection stays consistent.
- 6nf 7y agoThat doesn't make sense - how are you eventually moving to a RDBMS if your data is not suited to it?
- scarface74 7y agoWhat do you mean how? Anything that you can store in object database you can normalize and store in an RDMS. ORMs have been translating relational models back and forth to object models for decades. In the case of Mongo, you just create one object containing other objects, lists, arrays etc and the driver serializes it to a JSON like structure and stores it as is in the collection. In the case of an RDMS, you create your C# classes to model your tables and relationships. The driver translates the LINQ to the appropriate query language.
- liability 7y ago> Why use a relational store? If you’re working with a system that will only be read and written by an object based language? Why keep converting back and forth between a relational model and an object oriented model? Well I can't tell you what the right choice in your system is, but in the general case I think going with a relational model by default generally makes sense because it's rather future proof. By that I mean a relational model gives you the most flexibility in the future to evolve your system in ways you couldn't/didn't anticipate when the system was initially designed.
- scarface74 7y agoIf your data store is behind an API you modify the API. You’re often using a different database for your OLAP and OLTP anyway.
- xchaotic 7y agoI think you got it backwards. A relational schema change is required and probably a data reindex or reload when you change a data model so relational is the least flexible as opposed to something like Mongo nosql?
- Spivak 7y agoIf you’re just talking about storing and retrieving documents in a hierarchy with a semi-fixed format then aren’t you asking for a filesystem?
- scarface74 7y agoHow do you propose that you query a filesystem? In this context, we are referring to a “document” as a structured JSON document. You still have a semi known structure with fields that you can index and query.
- irishsultan 7y agoA schema change can handle changes needed to existing data, if you don't do that then sure Mongo is easier, but then you've broken data in your system.
- eloff 7y agoI worked on a project with similar requirements. I just serialized the data with protobufs, encrypted it, and stashed it in S3. It was sensitive data so this also had the advantage of being easy to secure and audit. No point using a relational db for that kind of thing.
- scarface74 7y agoAnd then when you need to do reports on the data and query it?
- jaequery 7y agoWhy not just use Postgres, set a field as jsonb, done?
- scarface74 7y agoWhy use Postgres just to store JSON? The entire tooling around Mongo is better for JSON Data. Not to mention the LINQ driver.... And you can’t do updates on individual JSON fields in Postgres.
- mateuszf 7y agoYes you can - this is an article crated in 2017 https://www.idalko.com/crud-operations-postgres-jsonb/ https://www.idalko.com/crud-operations-postgres-jsonb/
- scarface74 7y agoFrom the article, The problematic part with PostgresSQL JSONB is modifying a JSONB column content. In any case, we totally replace the old content by a new one. So, the update operations turn to the complex queries that can lose the content. You can avoid this by performing the full JSON reorganization before the persistent operation. You still don’t have the richness of MongoQuery and the aggregation framework and the tooling around working with JSON data isn’t there. Let alone the native driver support.