summaryrefslogtreecommitdiff
path: root/src/mongo/db/key.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-03-19 22:53:59 -0400
committerEliot Horowitz <eliot@10gen.com>2012-03-21 20:13:27 -0400
commit269217c81184591a0bd99c18f6d4a328f0c3adc4 (patch)
tree04879d00b667f2803151842e6c6e03dd1ebbb1e4 /src/mongo/db/key.h
parentb12918ac0cad922eab06e47143b4e8a7b4fa2421 (diff)
downloadmongo-269217c81184591a0bd99c18f6d4a328f0c3adc4.tar.gz
Key::isValid
Diffstat (limited to 'src/mongo/db/key.h')
-rw-r--r--src/mongo/db/key.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/key.h b/src/mongo/db/key.h
index 9284cdc7422..e31d4108100 100644
--- a/src/mongo/db/key.h
+++ b/src/mongo/db/key.h
@@ -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;
};
@@ -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;