Skip to content

Commit

Permalink
Key::isValid
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Mar 22, 2012
1 parent b12918a commit 269217c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mongo/db/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace mongo {
bool isCompactFormat() const { return false; }
bool woEqual(const KeyBson& r) const;
void assign(const KeyBson& rhs) { *this = rhs; }
bool isValid() const { return true; }
private:
BSONObj _o;
};
Expand Down Expand Up @@ -84,6 +85,8 @@ namespace mongo {
/** only used by geo, which always has bson keys */
BSONElement _firstElement() const { return bson().firstElement(); }
bool isCompactFormat() const { return *_keyData != IsBSON; }

bool isValid() const { return _keyData > (const unsigned char*)1; }
protected:
enum { IsBSON = 0xff };
const unsigned char *_keyData;
Expand Down

0 comments on commit 269217c

Please sign in to comment.