Using DB triggers is something bad? I have started using NoSLQ databases (CouchDB and MongoDB) and I can't find anything intuitive or native to the BD.

The worse is that I have googled it and I rarely find people asking for triggers in NoSQL databases.

What am I missing? My concepts about RDBMS blind me about NoSQL?

  • 1
    Triggers don't make sense in a NoSQL database because everything is already essentially a trigger.

    In other words, whereas a trigger is something that fires when a change occurs to a certain table, in NoSQL *everything* happens only when a change is made.

    It's a different philosophy: whereas SQL is basically a big living datastore that you can query on demand to get the info you want, in NoSQL there are views that are built up and maintained incrementally. In other words, the views are kind of what your triggers were previously doing: any kind of processing that you need to take place when something changes happens in a view, and you can emit whatever you want from a view.

    Not sure if that helps at all…?
  • 1
    Try looking into RavenDB and its indexes, which are much more similar to the triggers you know from relational databases. Once you've grokked that, understanding the concept with other document databases should make more sense.
  • 0
    Firebase have that https://firebase.google.com/docs/...

    The only very big downside of firebase, it is closed source and can follow the Path way :/
  • 0
    @gruiiik there's an open source self-hosted alternative which claims to be compatible with firebase. I can't remember its name though.
  • 0
  • 2
    @devios1 Thanks! It helps me understand certain logic about NoSQL. Now I'll google that view thing and it's MongoDB equivalent.
  • 0
    @configurator Thanks. However, I need to use MongoDB.
Add Comment