Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "fawn", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Library for atomic-ish operations in MongoDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ # Fawn | ||
## Getting Started<a name="getting_started"></a>: | ||
## <a name="getting_started"></a>Getting Started: | ||
@@ -20,3 +20,3 @@ Install [node.js](https://nodejs.org) and [mongoDB](https://www.mongodb.com/download-center) | ||
## Usage<a name="usage"></a>: | ||
## <a name="usage"></a>Usage: | ||
@@ -27,3 +27,3 @@ ```javascript | ||
### Examples<a name="examples"></a> | ||
### <a name="examples"></a>Examples | ||
Say you have two bank accounts, one belongs to John Smith and the other belongs to Broke Ass. You would like to transfer $20 from John Smith to Broke Ass. Assuming all first name and last name pairs are unique, this might look like: | ||
@@ -78,3 +78,3 @@ | ||
## API<a name="api"></a> | ||
## <a name="api"></a>API | ||
@@ -92,3 +92,3 @@ - [Fawn.init](#fawn_init) | ||
### Fawn.init(db, _collection, options)<a name="fawn_init"></a>: Initialize Fawn | ||
### <a name="fawn_init"></a>Fawn.init(db, _collection, options): Initialize Fawn | ||
> db (required): [mongoose](https://github.com/Automattic/mongoose) instance or [connection string](https://docs.mongodb.com/manual/reference/connection-string/) | ||
@@ -128,3 +128,3 @@ | ||
<br> | ||
### Fawn.Task()<a name="fawn_task"></a>: Create a Fawn task | ||
### <a name="fawn_task"></a>Fawn.Task(): Create a Fawn task | ||
@@ -139,3 +139,3 @@ > returns: A new task | ||
<br> | ||
### task.initModel(modelName, schema)<a name="task_initmodel"></a>: To initialize a model with a Schema. | ||
### <a name="task_initmodel"></a>task.initModel(modelName, schema): To initialize a model with a Schema. | ||
@@ -160,3 +160,3 @@ > modelName (required): Name of the collection associated with this model | ||
<br> | ||
### task.save(model, doc)<a name="task_save"></a>: To save a document</b> | ||
### <a name="task_save"></a>task.save(model, doc): To save a document</b> | ||
@@ -185,3 +185,3 @@ > model (required): Name of the collection we're saving to or a mongoose model or a mongoose document | ||
[mongodb]: <https://docs.mongodb.com/manual/core/document/#document-query-filter> | ||
### task.update(model, condition, data)<a name="task_update"></a>: To update a document | ||
### <a name="task_update"></a>task.update(model, condition, data): To update a document | ||
@@ -210,3 +210,3 @@ > model (required): Name of the collection we're updating or a mongoose model or a mongoose document | ||
<br> | ||
### task.options(options)<a name="task_options"></a>: Add options to an update task. | ||
### <a name="task_options"></a>task.options(options): Add options to an update task. | ||
@@ -230,3 +230,3 @@ > options (required): Update options - same as in [mongoose update][] | ||
<br> | ||
### task.remove(model, condition)<a name="task_remove"></a>: Remove document(s) from a collection | ||
### <a name="task_remove"></a>task.remove(model, condition): Remove document(s) from a collection | ||
@@ -255,3 +255,3 @@ > model (required): Name of the collection we're deleting from or a mongoose model or a mongoose document | ||
<br> | ||
### task.run()<a name="task_run"></a>: Run a task. | ||
### <a name="task_run"></a>task.run(): Run a task. | ||
@@ -277,3 +277,3 @@ > returns: Promise | ||
<br> | ||
### Fawn.Roller()<a name="fawn_roller"></a>: Get the Roller object. | ||
### <a name="fawn_roller"></a>Fawn.Roller(): Get the Roller object. | ||
@@ -288,3 +288,3 @@ > returns: The Roller object | ||
<br> | ||
### Roller.roll()<a name="roller_roll"></a>: Roll back all incomplete transcations | ||
### <a name="roller_roll"></a>Roller.roll(): Roll back all incomplete transcations | ||
@@ -291,0 +291,0 @@ Returns all the documents affected by incomplete transactions to their original state. Should only be used when no tasks are in progress, usually on server startup. |