News for hackers. Stuff that matters.
Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @07:30PM (#20862491)
But Mongodb is so different from anything else that you need a major rewrite to get away from it.

Well actually....

One corner case. If you are using Mongo with the Mongo Linq driver in C#, you can switch it out for an RDMS without changing too much code with just a little foresight.

Re:Homebrew removes MongoDB from core formulas by chrischen on Monday September 02, 2019 @08:56PM (#20862883)
Also Foundation DB supports mongodb clients. It also powers iMessage.
Re:Homebrew removes MongoDB from core formulas by 6nf on Monday September 02, 2019 @07:45PM (#20862560)
So why not just use a RDMS from day one?
Re:Homebrew removes MongoDB from core formulas by zxcvbn4038 on Monday September 02, 2019 @10:22PM (#20863242)
A lot of people have difficulty trying to organize complex hierarchical data into rows and columns. A lot of places make you go through a dba to create or change a database which rubs power users the wrong way - and admittedly most of the dbas I’ve worked with are a lot more concerned with making backups fast then in your applications performance. Mongodb doesn’t make you do any of that. It doesn’t make you have authentication either. I think that’s a big reason why it got so popular.
Re:Homebrew removes MongoDB from core formulas by Spivak on Monday September 02, 2019 @11:00PM (#20863407)
I think it’s funny that web devs pretty much abandoned hierarchical databases since they are the OG database style.

I think it’s just going to take somebody shaking the cobwebs off of their X.500 manuals and making the query syntax and schemas a little more ergonomic for them to come back en vogue.

It’s one thing to have the ability to mold your DB to model hierarchical data but have your DB engine support it non-awkwardly might be a game changer. People are already used to apps needing a DB, cache, queues, S3, filesystem, service discovery, that adding one more thing would hardly break the bank.

Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @10:39PM (#20863320)
Database versioning and migrations are a pain. I’ve tried both home grown and commercial database systems to make database changes part of the CI/CD process. I haven’t found one that I liked.

When I did implement a system with C#/Mongo, I fell in love with changing my database schema just by changing my C# objects. With the C# driver you can include a Dictionary as part of your object to round trip unmapped fields.

Not to mention that after you go through all of your modeling and figuring out your aggregate roots, you can just store the entire object graph with one .Add and the entire object is stored atomically without having to worry about transactions, table locks, etc.

Unlike with an RDMS where your beautiful aggregate root has to constantly be composed and decomposed.

Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @08:04PM (#20862658)
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.
Re:Homebrew removes MongoDB from core formulas by liability on Monday September 02, 2019 @08:42PM (#20862819)
> 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.

Re:Homebrew removes MongoDB from core formulas by xchaotic on Monday September 02, 2019 @10:27PM (#20863267)
I 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?
Re:Homebrew removes MongoDB from core formulas by Spivak on Monday September 02, 2019 @11:02PM (#20863419)
If 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?
Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @11:20PM (#20863483)
How 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.
Re:Homebrew removes MongoDB from core formulas by irishsultan on Tuesday September 03, 2019 @08:47AM (#20865949)
A 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.
Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @09:13PM (#20862951)
If your data store is behind an API you modify the API. You’re often using a different database for your OLAP and OLTP anyway.
Re:Homebrew removes MongoDB from core formulas by eloff on Monday September 02, 2019 @08:56PM (#20862880)
I 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.

Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @09:11PM (#20862940)
And then when you need to do reports on the data and query it?
Re:Homebrew removes MongoDB from core formulas by jaequery on Monday September 02, 2019 @09:52PM (#20863105)
Why not just use Postgres, set a field as jsonb, done?
Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @10:18PM (#20863227)
Why 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.

Re:Homebrew removes MongoDB from core formulas by mateuszf on Tuesday September 03, 2019 @01:44AM (#20863974)
Yes you can - this is an article crated in 2017 https://www.idalko.com/crud-operations-postgres-jsonb/
Re:Homebrew removes MongoDB from core formulas by scarface74 on Tuesday September 03, 2019 @05:08AM (#20864824)
From 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.

Re:Homebrew removes MongoDB from core formulas by goatinaboat on Tuesday September 03, 2019 @03:31AM (#20864348)
Postgres is better than Mongo for all of Mongo’s use cases, and 100 others besides, why wouldn’t you use it?
Re:Homebrew removes MongoDB from core formulas by scarface74 on Tuesday September 03, 2019 @05:12AM (#20864841)
Including the Mongo aggregation framework, tooling, driver support, in the case I mentioned LINQ support, various reporting packages, etc?
Re:Homebrew removes MongoDB from core formulas by eloff on Tuesday September 03, 2019 @12:52PM (#20868503)
Due to the sensitive nature of the data and the need to keep it encrypted, breaking it down by columns into a schema we could query was a non goal.
Re:Homebrew removes MongoDB from core formulas by 6nf on Monday September 02, 2019 @08:05PM (#20862666)
That doesn't make sense - how are you eventually moving to a RDBMS if your data is not suited to it?
Re:Homebrew removes MongoDB from core formulas by scarface74 on Monday September 02, 2019 @08:18PM (#20862710)
What 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.