WL.JSONStore.enhance(name, func)
This function will add a named method to the prototype of Collections effectively extending their
capabilities.
• name – The name of the new function to add.
• func – The implementation of the new function.
The enhance() method returns a success code.
WL.JSONStore.find(query, options)
This function searches a collection to retrieve the set of documents that match a given criteria. If
the query object is defined as "{}" then all documents in the collection will be returned.
• query – A JavaScript object with properties that will be used as keys on the JSONStore to
find matching documents.
• options
◦ exact – Whether or not fuzzy matching (false) or exact matching (true) should be used to
locate documents.
◦ limit – A constraint defining the maximum number of documents to be returned. The
result may be fewer than this value if the query would result in less than this.
◦ offset – A zero based offset into the results returned. Using offset and limit together can
achieve "pagination" of results.
The find() method returns a promise.
WL.JSONStore.findAll(options)
Return all documents in the collection without performing a comparison by key.
• options
◦ limit – A constraint defining the maximum number of documents to be returned. The
result may be fewer than this value if the query would result in less than this.
◦ offset – A zero based offset into the results returned. Using offset and limit together can
achieve "pagination" of results.
The findAll() method returns an array of documents.
WL.JSONStore.findById(id)
Returns all documents with the specified Id. Id may be a single document id or an array of ids.
WL.JSONStore.get(collectionName)
Lookup and retrieve a JSONStore collection by name. The object returned has methods on it
corresponding to the methods available for collections.
• collectionName – The name of a collection.
The get() method returns a JavaScript object which has methods on it corresponding to the methods
available on a collection.
Page 112
Comentários a estes Manuais