From 96866a0d9ffd9315dbc168441ea94ce2307645f2 Mon Sep 17 00:00:00 2001 From: Lucas Dohmen Date: Wed, 18 Jun 2014 16:01:06 +0200 Subject: [PATCH] Some tweaks to the Foxx.Repository documentation --- .../modules/org/arangodb/foxx/repository.js | 55 ++++++------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/repository.js b/js/server/modules/org/arangodb/foxx/repository.js index aaa07958e5..ee76089514 100644 --- a/js/server/modules/org/arangodb/foxx/repository.js +++ b/js/server/modules/org/arangodb/foxx/repository.js @@ -34,11 +34,7 @@ var Repository, //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_initializer -/// Create a new instance of Repository -/// -/// `new FoxxRepository(collection, opts)` -/// -/// Create a new instance of Repository +/// Create a new instance of Repository with `new FoxxRepository(collection, opts)` /// /// A Foxx Repository is always initialized with a collection object. You can get /// your collection object by asking your Foxx.Controller for it: the @@ -108,9 +104,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_save -/// `save(model)` -/// -/// Save a model into the database +/// Save a model into the database with `save(model)` /// /// Expects a model. Will set the ID and Rev on the model. /// Returns the model. @@ -135,9 +129,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_byId -/// `byId(id)` -/// -/// Find a model by its ID +/// Find a model by its ID with `byId(id)` /// /// Returns the model for the given ID. /// @@ -157,9 +149,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_byExample -/// `byExample(example)` -/// -/// Find all models by an example +/// Find all models by an example with `byExample(example)` /// /// Returns an array of models for the given ID. /// @@ -181,9 +171,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_firstExample -/// `firstExample(example)` -/// -/// Find the first model that matches the example. +/// Find the first model that matches the example with `firstExample(example)` /// /// Returns a model that matches the given example. /// @@ -203,7 +191,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_all -/// `all()` +/// Find all entries in the collection with `all()` /// /// Returns an array of models that matches the given example. You need to provide /// both a skip and a limit value. @@ -232,9 +220,8 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_remove -/// `remove(model)` +/// Remove the model from the repository with `remove(model)` /// -/// Remove the model from the repository /// /// Expects a model /// @@ -253,9 +240,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_removeById -/// `removeById(id)` -/// -/// Remove the document with the given ID +/// Remove the document with the given ID with `removeById(id)` /// /// Expects an ID of an existing document. /// @@ -273,9 +258,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_removeByExample -/// `removeByExample(example)` -/// -/// Remove all documents that match the example +/// Remove all documents that match the example with `removeByExample(example)` /// /// Find all documents that fit this example and remove them. /// @@ -297,7 +280,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_replace -/// `replace(model)` +/// Replace an entry in the collection with its new version via `replace(model)` /// /// Find the model in the database by its `_id` and replace it with this version. /// Expects a model. Sets the Revision of the model. @@ -322,9 +305,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_replaceById -/// `replaceById(id, model)` -/// -/// Find an item by ID and replace it with the given model +/// Find an item by ID and replace it with the given model with `replaceById(id, model)` /// /// Find the model in the database by the given ID and replace it with the given. /// model. @@ -347,9 +328,7 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_replaceByExample -/// `replaceByExample(example, model)` -/// -/// Find an item by example and replace it with the given model +/// Find an item by example and replace it with the given model with `replaceByExample(example, model)` /// /// Find the model in the database by the given example and replace it with the given. /// model. @@ -376,9 +355,8 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_updateById -/// `updateById(id, object)` +/// Find an item by ID and update it with the attributes in the provided object with `updateById(id, object)` /// -/// Find an item by ID and update it with the attributes in the provided object. /// Returns the updated model. /// /// *Examples* @@ -395,9 +373,9 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_updateByExample -/// `updateByExample(example, object)` +/// Find an item by example and update it with the attributes in the provided object +/// with `updateByExample(example, object)` /// -/// Find an item by example and update it with the attributes in the provided object. /// Returns the updated model. /// /// *Examples* @@ -418,9 +396,8 @@ _.extend(Repository.prototype, { //////////////////////////////////////////////////////////////////////////////// /// @startDocuBlock JSF_foxx_repository_count -/// `count()` +/// Return the number of entries in this collection with `count()` /// -/// Return the number of entries in this collection /// /// *Examples* ///