diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-01-02 17:26:58 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-01-07 11:56:33 -0500 |
commit | f58fa5f78a91ce36d8e31d6730ebfdaa6cc1d5ab (patch) | |
tree | bd143554b3ba2f46edaa9a00a12f1e4840c7c142 /src/mongo/db/hasher_test.cpp | |
parent | de54755e568481d1bdef37339d899403e3b04d86 (diff) | |
download | mongo-f58fa5f78a91ce36d8e31d6730ebfdaa6cc1d5ab.tar.gz |
Make BSONObj::woCompare a total ordering
Changes:
* Date and Timestamp are now distinct with all Dates before all Timestamps.
* Numeric comparisons now correctly handle Doubles and Long > 2**53.
* CodeWScope doesn't strcmp BSONObjs or strings which may contain NULs.
There should be no changes in any of the cases where woCompare defined a
correct total ordering before. The new behavior matches the ordering defined
by KeyString.
Related tickets:
* SERVER-3304 Error comparing Date and Timestamp
* SERVER-3719 Total ordering over Longs and Doubles
* SERVER-7804 CodeWScope comparisons are broken
* SERVER-16632 Change WiredTiger index key format
Changes to the comparison function for aggregation will be handled separately
as SERVER-16708.
Diffstat (limited to 'src/mongo/db/hasher_test.cpp')
-rw-r--r-- | src/mongo/db/hasher_test.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/hasher_test.cpp b/src/mongo/db/hasher_test.cpp index a11113d13a9..808370922ef 100644 --- a/src/mongo/db/hasher_test.cpp +++ b/src/mongo/db/hasher_test.cpp @@ -346,12 +346,12 @@ namespace { BSONObj o = BSON( "check" << Date_t( 0x5566778811223344LL ) ); ASSERT_EQUALS( hashIt( o ), 4476222765095560467LL ); o = builder1.appendTimestamp( "check", 0x55667788LL * 1000LL, 0x11223344LL ).obj(); - ASSERT_EQUALS( hashIt( o ), 4476222765095560467LL ); + ASSERT_EQUALS( hashIt( o ), 4873046866288452390LL ); o = BSON( "check" << Date_t( 0 ) ); ASSERT_EQUALS( hashIt( o ), -1178696894582842035LL ); o = builder2.appendTimestamp( "check", 0 ).obj(); - ASSERT_EQUALS( hashIt( o ), -1178696894582842035LL ); + ASSERT_EQUALS( hashIt( o ), -7867208682377458672LL ); } TEST( BSONElementHasher, HashRegEx ) { |