Skip to content

Commit 8b28486

Browse files
author
emmanuel
committed
Changed name to Fawn
1 parent 157c3f4 commit 8b28486

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

README.md

+18-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Lint
1+
# Fawn
22
## Library for atomic-ish operations in MongoDB
33

4-
Lint provides the ability to carry out edits on a mongoDB database as a series of steps. If an error occurs on any of the steps, the database is returned to it's initial state (it's state before the transaction started). This README is not yet complete.
4+
Fawn provides the ability to carry out edits on a mongoDB database as a series of steps. If an error occurs on any of the steps, the database is returned to it's initial state (it's state before the transaction started). This README is not yet complete.
55

66
## Getting Started:
77

@@ -10,19 +10,18 @@ Install [node.js](https://nodejs.org) and [mongoDB](https://www.mongodb.com/down
1010
Start mongoDB in a terminal: ```mongod```
1111

1212
Then:
13-
```npm install oj-lint```
13+
```npm install fawn```
1414

1515
## Usage:
1616
```javascript
17-
var Lint = require("oj-lint"); //not yet final. package name may change
17+
var Fawn = require("fawn"); //not yet final. package name may change
1818
```
1919

2020
### Examples
2121
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:
2222

2323
```javascript
24-
// assuming Lint has been initialized. See Lint.init below
25-
var task = Lint.Task()
24+
var task = Fawn.Task()
2625

2726
//assuming "Accounts" is the Accounts collection
2827
task.update("Accounts", {firstName: "John", lastName: "Smith"}, {$inc: {balance: -20}})
@@ -42,8 +41,8 @@ task.update("Accounts", {firstName: "John", lastName: "Smith"}, {$inc: {balance:
4241
The server could crash before a task is complete, You can use the Roller to rollback all incomplete transactions before starting your server.
4342

4443
```javascript
45-
// assuming Lint has been initialized. See Lint.init below
46-
var roller = Lint.Roller();
44+
// assuming Fawn has been initialized. See Fawn.init below
45+
var roller = Fawn.Roller();
4746

4847
roller.roll()
4948
.then(function(){
@@ -53,25 +52,25 @@ roller.roll()
5352

5453
## API
5554

56-
### Lint.init(db, _collection, options): Initialize Lint
55+
### Fawn.init(db, _collection, options): Initialize Fawn
5756
> db (required): [mongoose](https://github.com/Automattic/mongoose) instance or [connection string](https://docs.mongodb.com/manual/reference/connection-string/)
5857
59-
> _collection (optional): name of collection to be used internally by Lint
58+
> _collection (optional): name of collection to be used internally by Fawn
6059
6160
> options (optional. lol): Connection options. Same as [mongoose connection options](http://mongoosejs.com/docs/connections.html#options)
6261
63-
<br>If you're using mongoose in your project initialize Lint with mongoose:
62+
<br>If you're using mongoose in your project initialize Fawn with mongoose:
6463

6564
```javascript
6665
var mongoose = require("mongoose");
6766

6867
mongoose.connect("mongodb://127.0.0.1:27017/testDB");
6968

7069
// remember, _collection is optional
71-
Lint.init(mongoose, "lint_collection_name_if_you_want_to_specify");
70+
Fawn.init(mongoose, "Fawn_collection_name_if_you_want_to_specify");
7271
```
7372

74-
Without mongoose, Initialze Lint like so:
73+
Without mongoose, Initialze Fawn like so:
7574

7675
```javascript
7776
// options object (http://mongoosejs.com/docs/connections.html#options)
@@ -80,26 +79,26 @@ var options = {
8079
pass: "teh_Kitti_passwrod"
8180
}
8281

83-
var collection = "lint_collection_name_if_you_want_to_specify";
82+
var collection = "Fawn_collection_name_if_you_want_to_specify";
8483

8584
// remember, _collection and options are optional
86-
Lint.init("mongodb://127.0.0.1:27017/testDB", collection || null, options || null);
85+
Fawn.init("mongodb://127.0.0.1:27017/testDB", collection || null, options || null);
8786
```
8887
<br>
89-
### Lint.Task(): Create a Lint task
88+
### Fawn.Task(): Create a Fawn task
9089

91-
After intitializing Lint, create a task like so:
90+
After intitializing Fawn, create a task like so:
9291

9392
```javascript
94-
var task = Lint.Task();
93+
var task = Fawn.Task();
9594
```
9695
<br>
9796
### task.initModel(modelName, schema): To initialize a model with a Schema.
9897
> modelName (required): Name of the collection associated with this model
9998
10099
> schema (required): Same as object passed to [mongoose Schema](http://mongoosejs.com/docs/guide.html#definition). Also see [validation](http://mongoosejs.com/docs/validation.html)
101100
102-
<br>If you're using mongoose, define your models with mongoose wherever possible. If the model has been defined by mongoose before this function is called, mongoose will throw an OverwriteModelError and if it was defined by Lint, Lint will throw an Error. Models can be defined only once.
101+
<br>If you're using mongoose, define your models with mongoose wherever possible. If the model has been defined by mongoose before this function is called, mongoose will throw an OverwriteModelError and if it was defined by Fawn, Fawn will throw an Error. Models can be defined only once.
103102

104103
```javascript
105104
var schema = {

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("./lib/lint");
1+
module.exports = require("./lib/fawn");

lib/lint.js lib/fawn.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var TaskMdl;
1212
var Task;
1313
var Roller;
1414

15-
var Lint = {
15+
var Fawn = {
1616
init: function(db, _collection, options){
1717
var dbType = typeof db;
1818
var types = "objectstring";
@@ -61,7 +61,7 @@ var Lint = {
6161

6262
function checkInitStatus(){
6363
if(!(mongoose && collection && TaskMdl)){
64-
throw new Error("Lint has not been initialized. Call Lint.init");
64+
throw new Error("Fawn has not been initialized. Call Fawn.init");
6565
}
6666
}
6767

@@ -96,4 +96,4 @@ function isMongoose(obj){
9696
&& obj.options;
9797
}
9898

99-
module.exports = Lint;
99+
module.exports = Fawn;

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "oj-lint",
3-
"version": "0.0.3",
2+
"name": "fawn",
3+
"version": "0.0.0",
44
"description": "Library for atomic-ish operations in MongoDB",
55
"main": "index.js",
66
"scripts": {

test_conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var config = {
44
db: "mongodb://127.0.0.1:27017/"
55
, DB: "test"
66
, TASKS: "lints"
7-
, Lint: require("./lib/lint")
7+
, Lint: require("./lib/fawn")
88
, Promise: require("bluebird")
99
, TEST_COLLECTION_A: "humans"
1010
, TEST_COLLECTION_B: "animals"

0 commit comments

Comments
 (0)