
Ask HN: Why are you using MongoDB? - tehlike
After postgres has implemented JSON&#x2F;JSONB support, I feel like there is no need to use mongodb and the likes. Given all other benefits of postgres (acid, tooling etc) it feels overall it&#x27;s better suited for cases where you&#x27;d use mongo for.<p>I heard stories where people would just start with mongo and eventually migrate to more mature tech as they go, but that need seem to have evaporated.<p>Thoughts?
======
scarface74
I don’t currently use Mongo. But some reasons I would:

1\. Because Postgres support for complex JSON queries are sub par compared to
MongoDB

2\. When I did use MongoDB it was with C#. The Mongo Linq driver is excellent.
You write standard Linq queries and it gets translated to MongoQuery. You use
standard C# POCO objects and the compiler ensures a consistent “schema”.

~~~
tehlike
Can you give examples to #1?

Did mongo linq driver support everything linq supported? I assume joins would
not be or other complex things you'd otherwise use with rdbms.

On postgres + linq + document db - check:
[https://martendb.io/documentation/documents/querying/linq/](https://martendb.io/documentation/documents/querying/linq/)

~~~
scarface74
Yes it supports joins.

[https://www.axonize.com/blog/iot-technology/joining-
collecti...](https://www.axonize.com/blog/iot-technology/joining-collections-
in-mongodb-using-the-c-driver-and-linq/)

The weird left join syntax for LINQ with Mongo is endemic to how LINQ does
left joins even with an RDMS. Yeah it’s obtuse.

~~~
tehlike
Not always - depending on the underlying linq provider, you could probably
query the child collection diretly without join and it would generate the
proper sql. It's a function of ORM though, but if you are using linq you
probably have EF or NHibernate going for it (i was a former nhibernate
developer around the time linq support was added)

~~~
scarface74
Yes you usually can query the child directly. I did a bunch of left joins with
LINQ when I knew SQL, but didn’t understand how EF worked as well as I do now.

I watched videos by Julie Lerman and since then I learned that any time you do
an explicit join with EF, you’re probably doing it wrong.

I haven’t used Mongo in years , but I would be surprised if there isn’t some
type of annotation that you could do on a class to tell the driver how to map
the relationships so it would do it implicitly.

My recent experience with DynamoDB best practices though is that is usually a
smell when you try to bring over relational thinking to a NoSQL database and
you should carefully think about your design decisions.

------
searchableguy
They are probably using proprietary tools for mongo such as rockset:
[https://rockset.com/](https://rockset.com/)

Someone pointed that out to me when I answered a question dismissing mongo.

------
three_legs
I've heard it's good for huge datasets that you want to shard, that mongo
makes it easy to shard. The use case was per second location updates stored
for at least 30 days

------
dustingetz
Web scale

