Live data from Hacker News

A proof of concept MongoDB clone built on Postgres

github.com

21–30 of 51 posts

Re: A proof of concept MongoDB clone built on Postgres

#21
post #2

Why?

Developer here (woke up surprised it was on hn again), why not?

The blog posts go into more details: http://legitimatesounding.com/blog/building_a_mongodb_clone_... and http://legitimatesounding.com/blog/building_a_mongodb_clone_...

Re: A proof of concept MongoDB clone built on Postgres

#22

Earlier quoted context omitted.

Write a function in PLV8?

Or Python, or any language that has a PL in PostgreSQL. Unfortunately a lot of people consider that a hack, and they're not wrong. If we can address fields with operators (->, ->>, etc.) then why can't those operators modify, too? It works for everything else, after all. It's fairly counter-intuitive from a dev perspective. That, and PLV8 still doesn't support JSONB. With JSONB being so much more efficient, faster, a…

There have been calls to move toward jsonb, as well as a pull request for newer v8, but development seems to have stalled.

Re: A proof of concept MongoDB clone built on Postgres

#24
post #6

How are JSON updates handled? For those who aren't aware, Postgres currently lacks support for doing updates to JSON fields via SQL[1]. For many this isn't a problem, but I'd imagine that people expecting a MongoDB clone would need it. [1] But even though you can individually address the various fields within the JSON document, you can’t update a single field. Well, actually you can, but by extracting the entire JSON…

[deleted]

Re: A proof of concept MongoDB clone built on Postgres

#25
post #6

How are JSON updates handled? For those who aren't aware, Postgres currently lacks support for doing updates to JSON fields via SQL[1]. For many this isn't a problem, but I'd imagine that people expecting a MongoDB clone would need it. [1] But even though you can individually address the various fields within the JSON document, you can’t update a single field. Well, actually you can, but by extracting the entire JSON…

Use a transaction maybe?

Re: A proof of concept MongoDB clone built on Postgres

#26
post #12

DB2 also implements the MongoDB query language: http://www.ibm.com/developerworks/data/library/techarticle/d... So does CouchDB: https://cloudant.com/blog/couchdb-and-mongodb-let-our-query-...

That's an excellent news for CouchDB, frankly writting map/reduce functions was a bit hard. CouchDB has excellent features (multi master syncs,...), I look forward using CouchDB again where it makes sense.

Re: A proof of concept MongoDB clone built on Postgres

#27

Earlier quoted context omitted.

Write a function in PLV8?

Or Python, or any language that has a PL in PostgreSQL. Unfortunately a lot of people consider that a hack, and they're not wrong. If we can address fields with operators (->, ->>, etc.) then why can't those operators modify, too? It works for everything else, after all. It's fairly counter-intuitive from a dev perspective. That, and PLV8 still doesn't support JSONB. With JSONB being so much more efficient, faster, a…

> If we can address fields with operators (->, ->>, etc.) then why can't those operators modify, too? It works for everything else, after all. It's fairly counter-intuitive from a dev perspective.

It certainly doesn't work for "everything else". You can update individual "parts" of arrays and record types, that's it. And those exception are hard-coded, so someone would either have to hard-code similar exceptions for JSON values (ugly, inflexible, generally a bad idea) or generalize support for custom operators on the left-hand side of assignments in UPDATE. All this while trying to push out a release which was already late by months.

You can call everything an oversight, but with very limited resources available and the need to cut a release at some point, this is far from the truth in this case.

Re: A proof of concept MongoDB clone built on Postgres

#28

Earlier quoted context omitted.

I suspect there are lots of people who built applications on top of MongoDB who would like to transition away from Mongo onto a different database, or would at least like the option to be able to to. This may provide a good mechanism for a transition. Which leads to a question for the OP: does this work with mongoose.js?

Could be interessting for meteor.com, the mongodb only usage prevent me to use it.

problem : meteor relies on a specific mongodb feature,ie polling the db for any change. I heard there is experimental support for PG but it seems to rely on a complex hack using triggers ... So the issue isn't really about mongo queries, but whether it is possible to track db edits from third parties or not.

Re: A proof of concept MongoDB clone built on Postgres

#29
post #2

Why?

I suspect there are lots of people who built applications on top of MongoDB who would like to transition away from Mongo onto a different database, or would at least like the option to be able to to. This may provide a good mechanism for a transition. Which leads to a question for the OP: does this work with mongoose.js?

> I suspect there are lots of people who built applications on top of MongoDB who would like to transition away from Mongo onto a different database

What happened to separating the data access layer from the business logic layer? Oh yeah, "good architectural practices are so JEE ..." /s

Re: A proof of concept MongoDB clone built on Postgres

#30
post #12

DB2 also implements the MongoDB query language: http://www.ibm.com/developerworks/data/library/techarticle/d... So does CouchDB: https://cloudant.com/blog/couchdb-and-mongodb-let-our-query-...

FWIW, I've recently been implementing the MongoDB query language as well:

https://github.com/zumero/Elmo

In F#. Not even remotely close to usable or production-ready.

The approach here is somewhat different, as this implementation is built on SQLite, which it treats as a simple key-value storage layer.

Post reply on HN