1
0
Fork 0

mention 'byId' supports not only ids but also keys (from #1181)

This commit is contained in:
Patrick Huber 2014-12-16 11:26:37 +01:00
parent 447267a2db
commit c9fe2a6a9d
1 changed files with 15 additions and 8 deletions

View File

@ -143,13 +143,16 @@ _.extend(Repository.prototype, {
/// @startDocuBlock JSF_foxx_repository_byId /// @startDocuBlock JSF_foxx_repository_byId
/// `FoxxRepository#byId(id)` /// `FoxxRepository#byId(id)`
/// ///
/// Returns the model for the given ID. /// Returns the model for the given ID ("collection/key") or "key".
/// ///
/// @EXAMPLES /// @EXAMPLES
/// ///
/// ```javascript /// ```javascript
/// var myModel = repository.byId('test/12411'); /// var byIdModel = repository.byId('test/12411');
/// myModel.get('name'); /// byIdModel.get('name');
///
/// var byKeyModel = repository.byId('12412');
/// byKeyModel.get('name');
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -270,13 +273,14 @@ _.extend(Repository.prototype, {
/// @startDocuBlock JSF_foxx_repository_removeById /// @startDocuBlock JSF_foxx_repository_removeById
/// `FoxxRepository#removeById(id)` /// `FoxxRepository#removeById(id)`
/// ///
/// Remove the document with the given ID. /// Remove the document with the given ID ("collection/key") or "key".
/// Expects an ID of an existing document. /// Expects an ID or key of an existing document.
/// ///
/// @EXAMPLES /// @EXAMPLES
/// ///
/// ```javascript /// ```javascript
/// repository.removeById('test/12121'); /// repository.removeById('test/12121');
/// repository.removeById('12122');
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -336,8 +340,8 @@ _.extend(Repository.prototype, {
/// @startDocuBlock JSF_foxx_repository_replaceById /// @startDocuBlock JSF_foxx_repository_replaceById
/// `FoxxRepository#replaceById(id, object)` /// `FoxxRepository#replaceById(id, object)`
/// ///
/// Find the item in the database by the given ID and replace it with the /// Find the item in the database by the given ID ("collection/key") or "key"
/// given object's attributes. /// and replace it with the given object's attributes.
/// ///
/// If the object is a model, updates the model's revision and returns the model. /// If the object is a model, updates the model's revision and returns the model.
/// ///
@ -345,6 +349,7 @@ _.extend(Repository.prototype, {
/// ///
/// ```javascript /// ```javascript
/// repository.replaceById('test/123345', myNewModel); /// repository.replaceById('test/123345', myNewModel);
/// repository.replaceById('123346', myNewModel);
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -409,7 +414,8 @@ _.extend(Repository.prototype, {
/// @startDocuBlock JSF_foxx_repository_updateById /// @startDocuBlock JSF_foxx_repository_updateById
/// `FoxxRepository#updateById(id, object)` /// `FoxxRepository#updateById(id, object)`
/// ///
/// Find an item by ID and update it with the attributes in the provided object. /// Find an item by ID ("collection/key") or "key" and update it with the
/// attributes in the provided object.
/// ///
/// If the object is a model, updates the model's revision and returns the model. /// If the object is a model, updates the model's revision and returns the model.
/// ///
@ -417,6 +423,7 @@ _.extend(Repository.prototype, {
/// ///
/// ```javascript /// ```javascript
/// repository.updateById('test/12131', { newAttribute: 'awesome' }); /// repository.updateById('test/12131', { newAttribute: 'awesome' });
/// repository.updateById('12132', { newAttribute: 'awesomer' });
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////