Skip to content
Browse files

MongoDB 1.2.x support

  • Loading branch information...
1 parent 5af5fb7 commit d4143da1b9ff7e805c2937c6896a004b62e2acba @sjonnet sjonnet committed Nov 29, 2012
Showing with 11 additions and 9 deletions.
  1. +2 −0 Readme.md
  2. +1 −1 examples/update.js
  3. +1 −1 package.json
  4. +4 −4 test/db.js
  5. +3 −3 test_results.md
View
2 Readme.md
@@ -16,6 +16,7 @@ The api is same to node-mongodb-native, please see the [document](http://mongodb
when connection open error.
* 1.0.x
* 1.1.x
+* 1.2.x
```bash
$ make test-version
@@ -609,6 +610,7 @@ collection.group([], {}, {"count":0}, "function (obj, prev) { prev.count++; }",
Options:
upsert - true/false (perform upsert operation)
multi - true/false (update all documents matching spec)
+ Deprecated Options:
safe - true/false (perform check if the operation failed, required extra call to db)
**/
```
View
2 examples/update.js
@@ -3,7 +3,7 @@ var articles = db.collection('articles');
articles.insert({foo: 'bar', val: 'val1'}, function(err, result) {
console.log(result);
- articles.update({foo:'bar'}, {foo: 'bar', val:'val2'}, {safe: true}, function(err, result) {
+ articles.update({foo:'bar'}, {foo: 'bar', val:'val2'}, {strict: true}, function(err, result) {
console.log(result);
articles.find({foo: 'bar'}).toArray(function(err, docs){
View
2 package.json
@@ -21,7 +21,7 @@
"node": ">= 0.4.0"
},
"dependencies": {
- "mongodb": "< 1.2.0"
+ "mongodb": "1.2.x"
},
"devDependencies": {
"mocha": "*",
View
8 test/db.js
@@ -77,7 +77,7 @@ describe('db.js', function () {
before(function (done) {
var collection = db.collection('testExistsCollection');
- collection.insert({name: 'item1'}, {safe: true}, function (err) {
+ collection.insert({name: 'item1'}, {strict: true}, function (err) {
done(err);
});
});
@@ -123,7 +123,7 @@ describe('db.js', function () {
});
it('should add options and helper methods to collection', function (done) {
- db.bind('testExistsCollection', {safe: true}, {
+ db.bind('testExistsCollection', {strict: true}, {
totalCount: function (calllback) {
this.count(calllback);
}
@@ -147,10 +147,10 @@ describe('db.js', function () {
});
it('should throw error when bind collection not exists in safe mode', function (done) {
- db.bind('notExistsCollection', {safe: true});
+ db.bind('notExistsCollection', {strict: true});
db.notExistsCollection.count(function (err, count) {
should.exist(err);
- err.should.have.property('message', 'Collection notExistsCollection does not exist. Currently in strict mode.');
+ err.should.have.property('message', 'Collection notExistsCollection does not exist. Currently in safe mode.');
should.not.exist(count);
done();
});
View
6 test_results.md
@@ -523,7 +523,7 @@ db.testCollection.totalCount(function (err, total) {
should add options and helper methods to collection.
```js
-db.bind('testExistsCollection', {safe: true}, {
+db.bind('testExistsCollection', {strict: true}, {
totalCount: function (calllback) {
this.count(calllback);
}
@@ -549,10 +549,10 @@ db.testExistsCollection.insert({name: 'item2'}, function (err, row) {
should throw error when bind collection not exists in safe mode.
```js
-db.bind('notExistsCollection', {safe: true});
+db.bind('notExistsCollection', {strict: true});
db.notExistsCollection.count(function (err, count) {
should.exist(err);
- err.should.have.property('message', 'Collection notExistsCollection does not exist. Currently in strict mode.');
+ err.should.have.property('message', 'Collection notExistsCollection does not exist. Currently in safe mode.');
should.not.exist(count);
done();
});

0 comments on commit d4143da

Please sign in to comment.
Something went wrong with that request. Please try again.