summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-04-13 21:58:10 -0400
committerdwight <dwight@10gen.com>2011-04-13 21:58:10 -0400
commit7e2c810dc6bbf16ad8dbdd6f0310afaf51f833a1 (patch)
treed27e6cdf0b17c3fd901f0394ccbffa7b74e986e0
parent9bb89d382f6c8bdde0269899df289c6cc0850473 (diff)
downloadmongo-7e2c810dc6bbf16ad8dbdd6f0310afaf51f833a1.tar.gz
indexkey finishing some stuff
-rw-r--r--db/key.h14
-rw-r--r--db/query.cpp2
-rw-r--r--dbtests/btreetests.cpp2
3 files changed, 11 insertions, 7 deletions
diff --git a/db/key.h b/db/key.h
index 68763d459c1..832aa59ab09 100644
--- a/db/key.h
+++ b/db/key.h
@@ -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;