diff options
author | Randolph Tan <randolph@10gen.com> | 2014-02-10 12:16:04 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-02-13 10:22:22 -0500 |
commit | 78b5eeb13142f0d9bcb43e67848d5fec2f29366d (patch) | |
tree | 7e95858944e9384ecb4009a427790287d61872ac /src/mongo/db/write_concern_options.cpp | |
parent | db7b5a93e9bdfee1826a91b94a9f8b904be89813 (diff) | |
download | mongo-78b5eeb13142f0d9bcb43e67848d5fec2f29366d.tar.gz |
SERVER-12596 writeConcern {} and writeConcern {wtimeout: 1000} treated like {w: 0}
Diffstat (limited to 'src/mongo/db/write_concern_options.cpp')
-rw-r--r-- | src/mongo/db/write_concern_options.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/write_concern_options.cpp b/src/mongo/db/write_concern_options.cpp index 2658797e5e3..db18073a3ac 100644 --- a/src/mongo/db/write_concern_options.cpp +++ b/src/mongo/db/write_concern_options.cpp @@ -37,6 +37,9 @@ namespace mongo { const BSONObj WriteConcernOptions::Unacknowledged(BSON("w" << W_NONE)); Status WriteConcernOptions::parse( const BSONObj& obj ) { + if ( obj.isEmpty() ) { + return Status( ErrorCodes::BadValue, "write concern object cannot be empty" ); + } bool j = obj["j"].trueValue(); bool fsync = obj["fsync"].trueValue(); @@ -61,6 +64,7 @@ namespace mongo { else if ( e.eoo() || e.type() == jstNULL || e.type() == Undefined ) { + wNumNodes = 1; } else { return Status( ErrorCodes::BadValue, "w has to be a number or a string" ); |