A fast, low memory, transactional, index & query enabled NoSQL database server for node.js that easily syncs with browser and node.js clients and servers
I'm trying to port an application from Firebase to AceBase and I'm having trouble migrating the authorization (security) rules:
In Firebase, the newData variable references the prospective state of the entire database should the write operation being checked go through. While it points to the current property by default, it's possible to use child() and parent() to access any value in the database whether it was part of the write or not. It looks like AceBase uses data for this instead but it only holds the values updated as part of the operation, so if we expect differently structured operations at a given location then we must manually check whether a new value is in fact being written and fall back to old data if not in our .validate rules.
In Firebase, the root and data variables allow synchronous access to the current state of the entire database; any values obtained through them are guaranteed to represent a single state of the database during the execution of all rules leading up to either applying or rejecting the operation. The equivalent in AceBase appears to be the async value() function, but it's not clear whether the database could be mutated by concurrent requests while waiting for value() to return, either within a rule or between rules for a single operation.
If my understanding above is correct, then:
Would it be possible for AceBase to support the Firebase semantics for data / newData, even if not using that exact syntax?
If not, does AceBase at least guarantee that any paths accessed with value() won't be mutated until the operation is either applied or rejected?
I'm trying to port an application from Firebase to AceBase and I'm having trouble migrating the authorization (security) rules:
newData
variable references the prospective state of the entire database should the write operation being checked go through. While it points to the current property by default, it's possible to usechild()
andparent()
to access any value in the database whether it was part of the write or not. It looks like AceBase usesdata
for this instead but it only holds the values updated as part of the operation, so if we expect differently structured operations at a given location then we must manually check whether a new value is in fact being written and fall back to old data if not in our.validate
rules.root
anddata
variables allow synchronous access to the current state of the entire database; any values obtained through them are guaranteed to represent a single state of the database during the execution of all rules leading up to either applying or rejecting the operation. The equivalent in AceBase appears to be the asyncvalue()
function, but it's not clear whether the database could be mutated by concurrent requests while waiting forvalue()
to return, either within a rule or between rules for a single operation.If my understanding above is correct, then:
data
/newData
, even if not using that exact syntax?value()
won't be mutated until the operation is either applied or rejected?Thanks.
(cc @fahhem)