diff --git a/mongodb/README.md b/mongodb/README.md index f6dd8f4c5dfa9c3f7adad5f87081e6aebe1392d3..7340df4cf634c5f8be435b7891e97bf9da9b6d78 100644 --- a/mongodb/README.md +++ b/mongodb/README.md @@ -85,6 +85,7 @@ See the next section for the list of configuration parameters for MongoDB. - For the complete set of options for the synchronous driver see: - http://api.mongodb.org/java/current/index.html?com/mongodb/MongoClientURI.html - Default value is `mongodb://localhost:27017/ycsb?w=1` + - Default value of database is `ycsb` - `mongodb.batchsize` - Useful for the insert workload as it will submit the inserts in batches inproving throughput. diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java index c57ff5183c587f8d929a18e05d30618373d6416a..238a824d7ecac942998f95a424af7fcc67e0f7fa 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java @@ -55,7 +55,7 @@ import com.yahoo.ycsb.DBException; * * Properties to set: * - * mongodb.url=mongodb://localhost:27017 mongodb.database=ycsb + * mongodb.url=mongodb://localhost:27017 * mongodb.writeConcern=normal * * @author rjm @@ -180,7 +180,7 @@ public class AsyncMongoDbClient extends DB { batchSize = Integer.parseInt(props.getProperty("mongodb.batchsize", "1")); // Just use the standard connection format URL - // http://docs.mongodatabase.org/manual/reference/connection-string/ + // http://docs.mongodb.org/manual/reference/connection-string/ // to configure the client. String url = props.getProperty("mongodb.url", "mongodb://localhost:27017/ycsb?w=1"); diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java index a2e50b329cd3b4a9c1ad72c0b2f9b9d8bd45311b..343a2e5e42d7fa0fda9c9c40e5290f84f7775864 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java @@ -46,8 +46,8 @@ import com.yahoo.ycsb.DBException; * * Properties to set: * - * mongodatabase.url=mongodb://localhost:27017 mongodatabase.database=ycsb - * mongodatabase.writeConcern=acknowledged + * mongodb.url=mongodb://localhost:27017 + * mongodb.writeConcern=acknowledged * * @author ypai */ @@ -159,11 +159,9 @@ public class MongoDbClient extends DB { batchSize = Integer.parseInt(props.getProperty("batchsize", "1")); // Just use the standard connection format URL - // http://docs.mongodatabase.org/manual/reference/connection-string/ + // http://docs.mongodb.org/manual/reference/connection-string/ // to configure the client. - // - // Support legacy options by updating the URL as appropriate. - String url = props.getProperty("mongodatabase.url", null); + String url = props.getProperty("mongodb.url", null); boolean defaultedUrl = false; if (url == null) { defaultedUrl = true; @@ -178,7 +176,7 @@ public class MongoDbClient extends DB { + url + "'. Must be of the form " + "'mongodb://<host1>:<port1>,<host2>:<port2>/database?options'. " - + "See http://docs.mongodatabase.org/manual/reference/connection-string/."); + + "http://docs.mongodb.org/manual/reference/connection-string/"); System.exit(1); } @@ -191,19 +189,12 @@ public class MongoDbClient extends DB { databaseName = uriDb; } else { - databaseName = props.getProperty("mongodatabase.database", - "ycsb"); - } + //If no database is specified in URI, use "ycsb" + databaseName = "ycsb"; - if ((databaseName == null) || databaseName.isEmpty()) { - System.err - .println("ERROR: Invalid URL: '" - + url - + "'. Must provide a database name with the URI. " - + "'mongodb://<host1>:<port1>,<host2>:<port2>/database"); - System.exit(1); } + readPreference = uri.getOptions().getReadPreference(); writeConcern = uri.getOptions().getWriteConcern();