Permalink
Browse files

Merge branch 'upgrade-to-mongodb-1.2.x'

Conflicts:
	lib/connect-mongo.js
	test/connect-mongo.test.js
  • Loading branch information...
2 parents e1d765b + 0ca5f1a commit ef9f37d1d425a3c184558b29df8dc50070ea39af @kenpratt kenpratt committed Jan 12, 2013
Showing with 11 additions and 6 deletions.
  1. +6 −3 lib/connect-mongo.js
  2. +1 −1 package.json
  3. +4 −2 test/connect-mongo.test.js
View
@@ -20,7 +20,8 @@ var defaultOptions = {host: '127.0.0.1',
port: 27017,
stringify: true,
collection: 'sessions',
- auto_reconnect: false};
+ auto_reconnect: false,
+ w: 1};
module.exports = function(connect) {
var Store = connect.session.Store;
@@ -84,7 +85,8 @@ module.exports = function(connect) {
new mongo.Server(options.mongoose_connection.db.serverConfig.host,
options.mongoose_connection.db.serverConfig.port,
options.mongoose_connection.db.serverConfig.options
- ));
+ ),
+ { w: options.w || defaultOptions.w });
} else {
if(!options.db) {
@@ -101,7 +103,8 @@ module.exports = function(connect) {
{
auto_reconnect: options.auto_reconnect ||
defaultOptions.auto_reconnect
- }));
+ }),
+ { w: options.w || defaultOptions.w });
}
}
this.db_collection_name = options.collection || defaultOptions.collection;
View
@@ -5,7 +5,7 @@
"keywords": ["connect", "mongo", "mongodb", "session", "express"],
"author": "Casey Banner <kcbanner@gmail.com>",
"dependencies": {
- "mongodb": "1.0.x"
+ "mongodb": "1.2.x"
},
"devDependencies": {
"mocha": "1.x",
@@ -7,6 +7,7 @@ var connect = require('connect');
var MongoStore = require('../')(connect);
var assert = require('assert');
+var defaultOptions = {w: 1};
var options = {db: 'connect-mongo-test'};
var mongo = require('mongodb');
@@ -39,11 +40,12 @@ var open_db = function(options, callback) {
new mongo.Server(options.mongoose_connection.db.serverConfig.host,
options.mongoose_connection.db.serverConfig.port,
options.mongoose_connection.db.serverConfig.options
- ));
+ ),
+ { w: options.w || defaultOptions.w });
} else if (typeof options.db == "object") {
db = options.db
} else {
- db = new mongo.Db(options.db, new mongo.Server('127.0.0.1', 27017, {}));
+ db = new mongo.Db(options.db, new mongo.Server('127.0.0.1', 27017, {}), { w: options.w || defaultOptions.w });
}
if (db.openCalled) {

0 comments on commit ef9f37d

Please sign in to comment.