JSONStoreCollection Class Reference
| Inherits from | NSObject |
| Declared in | JSONStoreCollection.h |
Tasks
-
collectionNameproperty -
searchFieldsproperty -
additionalSearchFieldsproperty -
reopenedproperty -
_dropFirstproperty -
– initWithName: -
– setSearchField:withType: -
– setAdditionalSearchField:withType: -
– removeCollectionWithError: -
– clearCollectionWithError: -
– addData:andMarkDirty:withOptions:error: -
– replaceDocuments:andMarkDirty:error: -
– findWithQueryParts:andOptions:error: -
– findAllWithOptions:error: -
– findWithIds:andOptions:error: -
– countAllDocumentsAndReturnError: -
– countWithQueryParts:error: -
– countAllDirtyDocumentsWithError: -
– markDocumentsClean:error: -
– allDirtyAndReturnError: -
– isDirtyWithDocumentId:error: -
– changeData:withReplaceCriteria:addNew:markDirty:error: -
– removeWithIds:andMarkDirty:error:
Properties
_dropFirst
Private. Remove the collection (drop table [collection]) before initializing.
@property (nonatomic) BOOL _dropFirstAvailability
IBM Worklight V6.2.0 @private
Declared In
JSONStoreCollection.hadditionalSearchFields
Additional Search fields that are tied to the collection.
@property (nonatomic, strong) NSMutableDictionary *additionalSearchFieldsAvailability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hcollectionName
Name of the collection.
@property (nonatomic, strong) NSString *collectionNameAvailability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hInstance Methods
addData:andMarkDirty:withOptions:error:
Stores data as documents in the collection.
- (NSNumber *)addData:(NSArray *)data andMarkDirty:(BOOL)markDirty withOptions:(JSONStoreAddOptions *)options error:(NSError **)errorParameters
- data
NSArray of JSON data represented as NSDictionaries
- markDirty
Determines if the documents that are added should be marked dirty (true) or not (false)
- options
Options for handling things like additional search fields
- error
Error
Return Value
Number data added, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hallDirtyAndReturnError:
Get all documents that are marked dirty in the collection.
- (NSArray *)allDirtyAndReturnError:(NSError **)errorParameters
- error
Error
Return Value
NSArray of all dirty documents in the collection, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hchangeData:withReplaceCriteria:addNew:markDirty:error:
Uses a replacement criteria to locate documents for a targeted replacement, if no existing document is found it checks the addNew flag to determine if a new document should be added.
- (NSNumber *)changeData:(NSArray *)data withReplaceCriteria:(NSArray *)replaceCriteriaSearchFields addNew:(BOOL)addNew markDirty:(BOOL)markDirty error:(NSError **)errorParameters
- data
NSArray of JSON objects as NSDictionary
- addNew
Determines if new JSON objects are added to the store if they are not already inside (true) or not (false)
- markDirty
Determines if the operation marks changes as dirty (true) or not (false)
- error
Error
Return Value
Number of documents changed, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hclearCollectionWithError:
Permanently deletes all the documents stored in a collection while preserving the accessor for the collection.
- (BOOL)clearCollectionWithError:(NSError **)errorParameters
- error
Error
Return Value
Boolean that indicates the operation failed (false) or succeeded (true)
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hcountAllDirtyDocumentsWithError:
Returns the total number of dirty documents in the collection.
- (NSNumber *)countAllDirtyDocumentsWithError:(NSError **)errorParameters
- error
Error
Return Value
Number of documents that are dirty in the collection, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hcountAllDocumentsAndReturnError:
Returns the total number of documents that exist in the collection.
- (NSNumber *)countAllDocumentsAndReturnError:(NSError **)errorParameters
- error
Error
Return Value
Number of documents in the collection, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hcountWithQueryParts:error:
Returns the total number of documents that match the query parts.
- (NSNumber *)countWithQueryParts:(NSArray *)queryParts error:(NSError **)errorReturn Value
Number of documents that matched the query parts, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hfindAllWithOptions:error:
Returns all documents in the collection.
- (NSArray *)findAllWithOptions:(JSONStoreQueryOptions *)options error:(NSError **)errorParameters
- options
Options such as filter, sort, limit, and offset
- error
Error
Return Value
All documents in the collection, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hfindWithIds:andOptions:error:
Returns all documents that match the _id values passed.
- (NSArray *)findWithIds:(NSArray *)ids andOptions:(JSONStoreQueryOptions *)options error:(NSError **)errorParameters
- ids
array of _id field values that is represented as an integers
- options
Options such as filter, sort, limit, and offset
- error
Error
Return Value
Documents found with matching _id fields, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hfindWithQueryParts:andOptions:error:
Locates documents inside a collection by using one or more query parts.
- (NSArray *)findWithQueryParts:(NSArray *)queryParts andOptions:(JSONStoreQueryOptions *)options error:(NSError **)errorParameters
- queryParts
Array of JSONStoreQueryPart objects
- options
Options such as filter, sort, limit, and offset
- error
Error
Return Value
All documents in the collection that matched the query parts, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hinitWithName:
Creates a new JSONStoreCollection instance for the collection with the given name.
- (JSONStoreCollection *)initWithName:(NSString *)collectionNameParameters
- collectionName
the name of the collection
Return Value
new instance
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hisDirtyWithDocumentId:error:
Returns whether the document represented by the given _id value is dirty or not.
- (BOOL)isDirtyWithDocumentId:(int)_id error:(NSError **)errorParameters
- _id
The _id field value of the document
- error
Error
Return Value
True if the document is dirty, false otherwise
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hmarkDocumentsClean:error:
Takes input from allDirtyAndReturnError: (which returns documents with an _operation key value pair) and marks documents as clean.
- (NSNumber *)markDocumentsClean:(NSArray *)documents error:(NSError **)errorParameters
- documents
NSArray of documents that are represented as NSDictionaries
- error
Error
Return Value
Number of documents marked clean, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hremoveCollectionWithError:
Permanently deletes all the documents stored in a collection and removes the accessor for that collection.
- (BOOL)removeCollectionWithError:(NSError **)errorParameters
- error
Error
Return Value
Boolean that indicates the operation failed (false) or succeeded (true)
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hremoveWithIds:andMarkDirty:error:
Removes documents from the collection by using one or more _id values. Removed documents are not returned by the different find operations and they do not affect count operations.
- (NSNumber *)removeWithIds:(NSArray *)ids andMarkDirty:(BOOL)markDirty error:(NSError **)errorParameters
- ids
NSArray of _id values represented as integers
- markDirty
Determines if the documents that are removed are marked as dirty (true) or not (false)
- error
Error
Return Value
Number documents removed, nil if there is a failure
Availability
IBM Worklight V6.2.0 @private
Declared In
JSONStoreCollection.hreplaceDocuments:andMarkDirty:error:
This method is used to modify documents inside a collection by replacing existing documents with given documents. The field that is used to perform the replacement is the document’s unique identifier (_id).
- (NSNumber *)replaceDocuments:(NSArray *)documents andMarkDirty:(BOOL)markDirty error:(NSError **)errorParameters
- documents
Array of documents represented as NSDictionaries with the following key value pairs: _id (integer) and json (NSDictionary).
- markDirty
Determines if the documents that are replaced should be marked dirty (true) or not (false)
- error
Error
Return Value
Number documents replaced, nil if there is a failure
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hsetAdditionalSearchField:withType:
Sets the given additional search field for the collection. Must be called before opening the collection. Cannot be changed after the collection is opened.
- (void)setAdditionalSearchField:(NSString *)additionalSearchField withType:(JSONStoreSearchFieldType)typeParameters
- additionalSearchField
the name of the additional search field
- type
the type of the additional search field
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.hsetSearchField:withType:
Sets the given search field for the collection. Must be called before opening the collection. Cannot be changed after the collection is opened.
- (void)setSearchField:(NSString *)searchField withType:(JSONStoreSearchFieldType)typeParameters
- searchField
the name of the search field
- type
the type of the search field
Availability
IBM Worklight V6.2.0
Declared In
JSONStoreCollection.h