Allow use of atomic operations

I proposed a change to Rocket.Chat Apps Engine here and here that would allow use of atomic operations.

I know we want the apps to be DB-Agnostic, but I strongly believe we should make it possible for app developers to use findAndModify or any other implementation of transactions (for other DBs).

The second part of it (which I have not pushed until we discuss) is allowing operations other than $set. I know there’s a risk with allowing any operation to run, but I believe we should at least support $inc and $setOnInsert.

@ojaegle @bradley.hilton @rodrigo.nascimento what do you think?

This makes sense to me as long as we still keep the specifics of mongo abstracted away from apps.

Persistence is going to be used a lot, it definitely needs to be able to be as performant as possible

I think we could have a mongo like API, maybe filtering the modifiers allowed, that would make the apps much more powerful and we can introduce another APIs in the future, like a redis API and the developers could choose which one to use.

@bradley.hilton and @ojaegle that do you think?

I’m all for options… but in my opinion we should pick a query syntax and stick to it. We need the flexibility in other areas. Having solid query syntax that they don’t have to worry about possible multiple varying levels of completeness.

If we pick a mongo like syntax as long as we go all in and support it regardless of what’s under the hood and don’t take the easy way out and just pass the query straight through to backing model :slightly_smiling_face:

Honestly, I don’t think we need to have a syntax but instead have a query builder that way it is database agnostic and not specific to one database or the other. Then the backend which implements the Apps Bridge will translate the query object built by the query builder…just my one cent.

1 Like