diff options
author | dwight <dwight@10gen.com> | 2011-04-13 21:58:10 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2011-04-13 21:58:10 -0400 |
commit | 7e2c810dc6bbf16ad8dbdd6f0310afaf51f833a1 (patch) | |
tree | d27e6cdf0b17c3fd901f0394ccbffa7b74e986e0 | |
parent | 9bb89d382f6c8bdde0269899df289c6cc0850473 (diff) | |
download | mongo-7e2c810dc6bbf16ad8dbdd6f0310afaf51f833a1.tar.gz |
indexkey finishing some stuff
-rw-r--r-- | db/key.h | 14 | ||||
-rw-r--r-- | db/query.cpp | 2 | ||||
-rw-r--r-- | dbtests/btreetests.cpp | 2 |
3 files changed, 11 insertions, 7 deletions
@@ -49,7 +49,11 @@ namespace mongo { BSONObj toBson() const; string toString() const { return toBson().toString(); } int dataSize() const; - const char * data() const; + const char * data() const { + return _keyData != 0 ? (const char *) _keyData : _o.objdata(); + } + + /** only used by geo, which always has bson keys */ BSONElement _firstElement() const { assert( _keyData == 0 ); return _o.firstElement(); @@ -69,9 +73,9 @@ namespace mongo { ~KeyV1Owned() { free((void*) _keyData); } }; - typedef KeyBson Key; - typedef KeyBson KeyOwned; - //typedef KeyV1 Key; - //typedef KeyV1Owned KeyOwned; + //typedef KeyBson Key; + //typedef KeyBson KeyOwned; + typedef KeyV1 Key; + typedef KeyV1Owned KeyOwned; }; diff --git a/db/query.cpp b/db/query.cpp index 7b307f8ea34..f6b0a4838cd 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -469,7 +469,7 @@ namespace mongo { if ( _bc ) { if ( _firstMatch.isEmpty() ) { _firstMatch = _bc->currKeyNode().key.toBson().getOwned(); - _firstMatchKey = Key(_firstMatch); + _firstMatchKey = Key(_firstMatch.objdata()); // if not match if ( _query.woCompare( _firstMatch, BSONObj(), false ) ) { setComplete(); diff --git a/dbtests/btreetests.cpp b/dbtests/btreetests.cpp index fee09920f4f..2344f4c0a84 100644 --- a/dbtests/btreetests.cpp +++ b/dbtests/btreetests.cpp @@ -506,7 +506,7 @@ namespace BtreeTests { class ArtificialTree : public BtreeBucket { public: void push( const BSONObj &key, const DiskLoc &child ) { - pushBack( dummyDiskLoc(), Key(key), Ordering::make( BSON( "a" << 1 ) ), child ); + pushBack( dummyDiskLoc(), KeyOwned(key), Ordering::make( BSON( "a" << 1 ) ), child ); } void setNext( const DiskLoc &child ) { nextChild = child; |