mirror of
https://github.com/sstent/node_app.git
synced 2026-01-26 23:21:41 +00:00
removing ned for second mongo
This commit is contained in:
40
node_modules/mongoskin/Readme.md
generated
vendored
40
node_modules/mongoskin/Readme.md
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# mongoskin
|
||||
# mongoskin [](http://travis-ci.org/kissjs/node-mongoskin)
|
||||
|
||||
[](http://travis-ci.org/kissjs/node-mongoskin)
|
||||

|
||||
|
||||
This project is a wrapper of [node-mongodb-native](https://github.com/mongodb/node-mongodb-native).
|
||||
The api is same to node-mongodb-native, please see the [document](http://mongodb.github.com/node-mongodb-native/) first.
|
||||
@@ -14,11 +14,12 @@ The api is same to node-mongodb-native, please see the [document](http://mongodb
|
||||
|
||||
* <del>>= 0.9.8 < 1.0.0</del>: mongodb have bug, it will throw a `TypeError: object is not a function`
|
||||
when connection open error.
|
||||
* 1.0.x
|
||||
* 1.1.x
|
||||
* <del>1.0.x</del>
|
||||
* <del>1.1.x</del>
|
||||
* 1.2.x
|
||||
|
||||
```bash
|
||||
$ make test-version
|
||||
$ make test
|
||||
```
|
||||
|
||||
<a name='index'>
|
||||
@@ -129,7 +130,7 @@ mongo.db('localhost:27017/testdb').collection('blog').find().toArray(function (e
|
||||
Server options and BSON options
|
||||
--------
|
||||
You can also set `auto_reconnect` options querystring.
|
||||
And native_parser options will automatically set if native_parser is avariable.
|
||||
And native_parser options will automatically set if native_parser is available.
|
||||
|
||||
```js
|
||||
var mongo = require('mongoskin');
|
||||
@@ -172,6 +173,10 @@ It is very useful if you want to use MVC patterns with nodejs and mongodb.
|
||||
You can also invoke collection by properties after bind,
|
||||
it could simplfy your `require`.
|
||||
|
||||
To keep your code in line with DRY principles, it's possible to create your own
|
||||
data layer by for example, setting up your own validators and/or default values
|
||||
inside the MVC methods as shown below in the config example
|
||||
|
||||
```js
|
||||
db.bind('posts', {
|
||||
findTop10 : function (fn) {
|
||||
@@ -180,8 +185,26 @@ db.bind('posts', {
|
||||
removeTagWith : function (tag, fn) {
|
||||
this.remove({tags:tag},fn);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
db.bind('settings', {
|
||||
|
||||
getAll: function(user, fn) {
|
||||
|
||||
this.find({user: user}).toArray(function(err, settings) {
|
||||
|
||||
// We want to set a default currency from within our app instead of storing it
|
||||
// for every user
|
||||
settings.currency = (typeof settings.currency !== "undefined") ? settings.currency : 'USD';
|
||||
|
||||
fn(err, settings);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
db.bind('comments');
|
||||
|
||||
db.collection('posts').removeTagWith('delete', function (err, replies) {
|
||||
@@ -245,7 +268,8 @@ var db = mongoskin.db([
|
||||
'192.168.0.2:27017/?auto_reconnect=true',
|
||||
'192.168.0.3:27017/?auto_reconnect=true'
|
||||
], {
|
||||
database: 'testdb'
|
||||
database: 'testdb',
|
||||
safe: true
|
||||
}, {
|
||||
connectArbiter: false,
|
||||
socketOptions: {
|
||||
@@ -587,6 +611,8 @@ collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }",
|
||||
Options:
|
||||
upsert - true/false (perform upsert operation)
|
||||
multi - true/false (update all documents matching spec)
|
||||
strict - true/false (perform check if the operation failed, required extra call to db)
|
||||
Deprecated Options:
|
||||
safe - true/false (perform check if the operation failed, required extra call to db)
|
||||
**/
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user