JsonDB
JsonDB copied to clipboard
How to implement the update only some properties of change
How to implement the update only some properties of change
The documentation is not clear on that matter :)
From the JDBDatabase
you get a JDBCollection
, then create a JDBView
, then create a JDBQuery
from that view.
From a JDBQuery
you can
- modify all docs with allAndModify:
- modify docs within limit with allInRange:andModify:
- or modify only the first doc with firstAndModify:
Those methods all take a JDBModifyOperation
code block that take the NSMutableDictionary
document to be modified, then expect you return options to tell JsonDB what type of modification you want to do
You can see this in action here:
- https://github.com/pierredavidbelanger/JsonDB/blob/1.0.0/JsonDB-Tests/JsonDB-Tests/UseCaseSpec.m#L60
- https://github.com/pierredavidbelanger/JsonDB/blob/1.0.0/JsonDB-Tests/JsonDB-Tests/UseCaseSpec.m#L104
- https://github.com/pierredavidbelanger/JsonDB/blob/1.0.0/JsonDB-Tests/JsonDB-Tests/UseCaseSpec.m#L147