From c9fe2a6a9d19e49f07d4eca44cce584f6f101e3b Mon Sep 17 00:00:00 2001 From: Patrick Huber Date: Tue, 16 Dec 2014 11:26:37 +0100 Subject: [PATCH] mention 'byId' supports not only ids but also keys (from #1181) --- .../modules/org/arangodb/foxx/repository.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/repository.js b/js/server/modules/org/arangodb/foxx/repository.js index ae095a9c70..7b9a507d84 100644 --- a/js/server/modules/org/arangodb/foxx/repository.js +++ b/js/server/modules/org/arangodb/foxx/repository.js @@ -143,13 +143,16 @@ _.extend(Repository.prototype, { /// @startDocuBlock JSF_foxx_repository_byId /// `FoxxRepository#byId(id)` /// -/// Returns the model for the given ID. +/// Returns the model for the given ID ("collection/key") or "key". /// /// @EXAMPLES /// /// ```javascript -/// var myModel = repository.byId('test/12411'); -/// myModel.get('name'); +/// var byIdModel = repository.byId('test/12411'); +/// byIdModel.get('name'); +/// +/// var byKeyModel = repository.byId('12412'); +/// byKeyModel.get('name'); /// ``` /// @endDocuBlock //////////////////////////////////////////////////////////////////////////////// @@ -270,13 +273,14 @@ _.extend(Repository.prototype, { /// @startDocuBlock JSF_foxx_repository_removeById /// `FoxxRepository#removeById(id)` /// -/// Remove the document with the given ID. -/// Expects an ID of an existing document. +/// Remove the document with the given ID ("collection/key") or "key". +/// Expects an ID or key of an existing document. /// /// @EXAMPLES /// /// ```javascript /// repository.removeById('test/12121'); +/// repository.removeById('12122'); /// ``` /// @endDocuBlock //////////////////////////////////////////////////////////////////////////////// @@ -336,8 +340,8 @@ _.extend(Repository.prototype, { /// @startDocuBlock JSF_foxx_repository_replaceById /// `FoxxRepository#replaceById(id, object)` /// -/// Find the item in the database by the given ID and replace it with the -/// given object's attributes. +/// Find the item in the database by the given ID ("collection/key") or "key" +/// and replace it with the given object's attributes. /// /// If the object is a model, updates the model's revision and returns the model. /// @@ -345,6 +349,7 @@ _.extend(Repository.prototype, { /// /// ```javascript /// repository.replaceById('test/123345', myNewModel); +/// repository.replaceById('123346', myNewModel); /// ``` /// @endDocuBlock //////////////////////////////////////////////////////////////////////////////// @@ -409,7 +414,8 @@ _.extend(Repository.prototype, { /// @startDocuBlock JSF_foxx_repository_updateById /// `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. /// @@ -417,6 +423,7 @@ _.extend(Repository.prototype, { /// /// ```javascript /// repository.updateById('test/12131', { newAttribute: 'awesome' }); +/// repository.updateById('12132', { newAttribute: 'awesomer' }); /// ``` /// @endDocuBlock ////////////////////////////////////////////////////////////////////////////////