3 ms·
Off course it was, prototyping speed on mongodb was (and probably still is) always excellent. Some features that don't scale are very nice to have when you don
by gnur 8y ago
Off course it was, prototyping speed on mongodb was (and probably still is) always excellent.
Some features that don't scale are very nice to have when you don't have scaling issues. For example, if you add tags to your documents and you want to query on those tags (find all documents containing tag A and B), it's nice that's just a builtin.
I haven't found a single datastore that is as developer friendly that supports that use case, so for now, I'm sticking with mongodb for my pet project.
(if you know of a datastore that has support for this query out of the box, please let me know)
- isoos 8y agoPostgresql JSONB?
- scottfr 8y agoIf I understand your query correctly, Google Cloud Firestore would support it. https://firebase.google.com/docs/firestore/query-data/queries#array_membership https://firebase.google.com/docs/firestore/query-data/querie...
- jchw 8y agoSomeone has mentioned PostgreSQL jsonb, which basically works the same way as Mongo, although I won't argue the query syntax is easier to learn. But also, PostgreSQL supports arrays, so you can have much more native tags as well, and it can be indexed and searched in a more traditional SQL fashion. I have only used this with Django ORM, but I believe it's pretty straightforward if my memory is correct.
- matthewmacleod 8y agoThe other answers have confirmed that Postgres will do this with array fields, and it's good advice to follow. It's also in my view much easier to read than MongoDB's query language is! CREATE TABLE documents (name text, tags text[]); INSERT INTO documents VALUES ('Doc1', '{tag1, tag2}'); INSERT INTO documents VALUES ('Doc2', '{tag2, tag3}'); INSERT INTO documents VALUES ('Doc3', '{tag2, tag3, tag4}'); SELECT * FROM documents WHERE tags @> '{tag1}'; name | tags ------+------------- Doc1 | {tag1,tag2} SELECT * FROM documents WHERE tags @> '{tag2}'; name | tags ------+------------- Doc1 | {tag1,tag2} Doc2 | {tag2,tag3} Doc3 | {tag2,tag3,tag4} SELECT * FROM documents WHERE tags @> '{tag2, tag3}'; name | tags ------+------------------ Doc2 | {tag2,tag3} Doc3 | {tag2,tag3,tag4} Postgres certainly isn't perfect, but it's usually a good answer to "how do I store and query data" where you don't have any particular specialist requirements.
- tnolet 8y agoUsing this almost 1:1 in a production app where customers can filter by tags. Works great.
- willvarfar 8y agoPostgres array columns are super neat! As I already use MySQL in many projects, I do much the same thing with MySQL's json support. I believe json is now supported by Sqlite too. Basically, if you already have an up-to-date relational database, then the chances are you can already use it as a sane document store. Just saying, so nobody reading the threads thinks they have to go grab some new database if they are already using one!
- scriptkiddy 8y agoRethinkDb: rethinkdb.com