Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change BSONObj::shallowEqual to binaryEqual

  • Loading branch information...
commit d790a3ec6d6729da69e92ac2b11d491139b692a0 1 parent bec8679
@erh erh authored
View
2  bson/bsonobj.h
@@ -308,7 +308,7 @@ namespace mongo {
/** This is "shallow equality" -- ints and doubles won't match. for a
deep equality test use woCompare (which is slower).
*/
- bool shallowEqual(const BSONObj& r) const {
+ bool binaryEqual(const BSONObj& r) const {
int os = objsize();
if ( os == r.objsize() ) {
return (os == 0 || memcmp(objdata(),r.objdata(),os)==0);
View
2  db/btreecursor.cpp
@@ -111,7 +111,7 @@ namespace mongo {
while( 1 ) {
// if ( b->keyAt(keyOfs).woEqual(keyAtKeyOfs) &&
// b->k(keyOfs).recordLoc == locAtKeyOfs ) {
- if ( keyAt(keyOfs).shallowEqual(keyAtKeyOfs) ) {
+ if ( keyAt(keyOfs).binaryEqual(keyAtKeyOfs) ) {
const _KeyNode& kn = keyNode(keyOfs);
if( kn.recordLoc == locAtKeyOfs ) {
if ( !kn.isUsed() ) {
View
4 db/jsobj.cpp
@@ -925,7 +925,7 @@ namespace mongo {
c.appendRegex("x", "goo");
BSONObj p = c.done();
- assert( !o.shallowEqual( p ) );
+ assert( !o.binaryEqual( p ) );
assert( o.woCompare( p ) < 0 );
}
@@ -1030,7 +1030,7 @@ namespace mongo {
BSONObj a = A.done();
BSONObj b = B.done();
BSONObj c = C.done();
- assert( !a.shallowEqual( b ) ); // comments on operator==
+ assert( !a.binaryEqual( b ) ); // comments on operator==
int cmp = a.woCompare(b);
assert( cmp == 0 );
cmp = a.woCompare(c);
View
10 s/shardkey.cpp
@@ -186,8 +186,8 @@ namespace mongo {
ShardKeyPattern k( fromjson("{a:1,'sub.b':-1,'sub.c':1}") );
BSONObj x = fromjson("{a:1,'sub.b':2,'sub.c':3}");
- assert( k.extractKey( fromjson("{a:1,sub:{b:2,c:3}}") ).shallowEqual(x) );
- assert( k.extractKey( fromjson("{sub:{b:2,c:3},a:1}") ).shallowEqual(x) );
+ assert( k.extractKey( fromjson("{a:1,sub:{b:2,c:3}}") ).binaryEqual(x) );
+ assert( k.extractKey( fromjson("{sub:{b:2,c:3},a:1}") ).binaryEqual(x) );
}
void moveToFrontTest() {
ShardKeyPattern sk (BSON("a" << 1 << "b" << 1));
@@ -195,13 +195,13 @@ namespace mongo {
BSONObj ret;
ret = sk.moveToFront(BSON("z" << 1 << "_id" << 1 << "y" << 1 << "a" << 1 << "x" << 1 << "b" << 1 << "w" << 1));
- assert(ret.shallowEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
+ assert(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
ret = sk.moveToFront(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1));
- assert(ret.shallowEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
+ assert(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
ret = sk.moveToFront(BSON("z" << 1 << "y" << 1 << "a" << 1 << "b" << 1 << "Z" << 1 << "Y" << 1));
- assert(ret.shallowEqual(BSON("a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "Z" << 1 << "Y" << 1)));
+ assert(ret.binaryEqual(BSON("a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "Z" << 1 << "Y" << 1)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.