Live data from Hacker News

A proof of concept MongoDB clone built on Postgres

github.com

31–40 of 51 posts

Re: A proof of concept MongoDB clone built on Postgres

#31
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-...

Note also that the Meteor project has "minimongo", which is yet another implementation of the MongoDB query language.

Re: A proof of concept MongoDB clone built on Postgres

#32
post #29

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?

> 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

Taking full advantage of the capabilities of the data layer has effects on the business logic layer. Sometimes it's worth it, sometimes it isn't.

Re: A proof of concept MongoDB clone built on Postgres

#33
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…

I don't know the answer to your question but JSON update is being worked on by the PG community. I think it is unlikely to make 9.5, but we will see.

http://www.postgresql.org/message-id/flat/54E00D1F.9060101@d...

Re: A proof of concept MongoDB clone built on Postgres

#34
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…

Write a function in PLV8?

currently, that is exactly how they are handled. the JSON structure is brought into memory, parsed, modified, and then written again to the database.

this is non-optimal, but currently the only method available.

Re: A proof of concept MongoDB clone built on Postgres

#35
post #28

Earlier quoted context omitted.

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.

There's infrastructure for that in postgres, since 9.4. See

http://www.postgresql.org/docs/devel/static/logicaldecoding.... for the (somewhat low level) description of the feature. You'd have to write an output plugin that formats the output as json, but that should be pretty easy.

Disclaimer: I'm the author of the feature ;)

Re: A proof of concept MongoDB clone built on Postgres

#38
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-...

Note also that the Meteor project has "minimongo", which is yet another implementation of the MongoDB query language.

I'd use it if it supported $near ...

Re: A proof of concept MongoDB clone built on Postgres

#39
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 started a mongo client implementation in node.js, but it fell off my radar - the goal was to get it to work with mongoose, etc: https://github.com/JerrySievert/mongolike-client (it is not yet complete).

in the end, i just wrote my own database system, with a query language that could act as an intermediary from multiple sources (SQL, mongo, etc).

but, this stuff is mostly just for fun, my day job keeps me plenty busy.

Post reply on HN