summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/index_descriptor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index/index_descriptor.h')
-rw-r--r--src/mongo/db/index/index_descriptor.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h
index 8734abea54d..9e58cbb7c46 100644
--- a/src/mongo/db/index/index_descriptor.h
+++ b/src/mongo/db/index/index_descriptor.h
@@ -20,6 +20,7 @@
#include "mongo/db/index.h" // For IndexDetails.
#include "mongo/db/jsobj.h"
+#include "mongo/db/namespace_details.h" // For NamespaceDetails.
namespace mongo {
@@ -44,10 +45,10 @@ namespace mongo {
* OnDiskIndexData is a pointer to the memory mapped per-index data.
* infoObj is a copy of the index-describing BSONObj contained in the OnDiskIndexData.
*/
- IndexDescriptor(OnDiskIndexData* data, BSONObj infoObj)
- : _onDiskData(data)
- , _infoObj(infoObj)
- , _numFields(infoObj.getObjectField("key").nFields()) { }
+ IndexDescriptor(NamespaceDetails* namespaceDetails, int indexNumber, OnDiskIndexData* data,
+ BSONObj infoObj)
+ : _namespaceDetails(namespaceDetails), _indexNumber(indexNumber), _onDiskData(data),
+ _infoObj(infoObj), _numFields(infoObj.getObjectField("key").nFields()) { }
//
// Information about the key pattern.
@@ -105,6 +106,9 @@ namespace mongo {
// Is this index sparse?
bool isSparse() const { return _infoObj["sparse"].trueValue(); }
+ // Is this index multikey?
+ bool isMultikey() const { return _namespaceDetails->isMultikey(_indexNumber); }
+
//
// Properties that are Index-specific.
//
@@ -127,6 +131,13 @@ namespace mongo {
string toString() { return _infoObj.toString(); }
private:
+ // Related catalog information.
+ NamespaceDetails* _namespaceDetails;
+
+ // What # index are we in the catalog represented by _namespaceDetails? Needed for setting
+ // and getting multikey.
+ int _indexNumber;
+
OnDiskIndexData* _onDiskData;
// The BSONObj describing the index. Accessed through the various members above.