News for hackers. Stuff that matters.
Re:What MongoDB got right by emilburzo on Friday November 13, 2015 @07:47AM (#10559511)
> Coming from PostgreSQL, you could do the same using LISTEN/NOTIFY?

I have to admit I was not aware of this feature.

However, from the docs[1]:

> Commonly, the channel name is the same as the name of some table in the database, and the notify event essentially means, "I changed this table, take a look at it to see what's new".

From what I understand, you just know that something has changed, the actual change is not included in the event, so you need at least another query to see what changed.

Did I understand correctly?

In MongoDB you get the operation (insert, update, delete), the document and another few details right in the event.

[1] http://www.postgresql.org/docs/9.4/static/sql-notify.html

Re:What MongoDB got right by ngrilly on Friday November 13, 2015 @08:27AM (#10559700)
Good question :-)

You can do as ddorian43 explained, by including a payload in your notification (using JSON or another format).

Or you can do as you suggested and query the database to fetch more information about the change.

Apart LISTEN/NOTIFY, which is a very powerful feature, PostgreSQL also provides "logical decoding" which solves problems similar to the ones solved by oplog tailing.

Re:What MongoDB got right by ddorian43 on Friday November 13, 2015 @08:13AM (#10559631)
When you notify, you can also include a payload (ex json) which can be whatever you want.
Re:What MongoDB got right by anentropic on Friday November 13, 2015 @09:00AM (#10559846)
I looked into this before and the Postgres docs say somewhere the payload size is limited and intended to be small metadata... in some cases you will not be able to fit the contents of the update into it
Re:What MongoDB got right by danneu on Friday November 13, 2015 @06:08PM (#10563025)
Looks like the default limit is 8000 bytes.