Storage Engine API
mongo::IndexSeekPoint Struct Reference

Describes a query that can be compared against an IndexKeyEntry in a way that allows expressing exclusiveness on a prefix of the key. More...

#include <index_entry_comparison.h>

Detailed Description

Describes a query that can be compared against an IndexKeyEntry in a way that allows expressing exclusiveness on a prefix of the key.

This is mostly used to express a location to seek to in an index that may not be representable as a valid key.

The "key" used for comparison is the concatenation of the first 'prefixLen' elements of 'keyPrefix' followed by the last 'keySuffix.size() - prefixLen' elements of 'keySuffix'.

The comparison is exclusive if either 'prefixExclusive' is true or if there are any false values in 'suffixInclusive' that are false at index >= 'prefixLen'.

Portions of the key following the first exclusive part may be ignored.

e.g.

Suppose that

keyPrefix = { "" : 1, "" : 2 }
prefixLen = 1
prefixExclusive = false
keySuffix = [ IGNORED, { "" : 5 } ]
suffixInclusive = [ IGNORED, false ]

==> key is { "" : 1, "" : 5 }
    with the comparison being done exclusively

Suppose that

keyPrefix = { "" : 1, "" : 2 }
prefixLen = 1
prefixExclusive = true
keySuffix = IGNORED
suffixInclusive = IGNORED

==> represented key is { "" : 1 }
    with the comparison being done exclusively

'prefixLen = 0' and 'prefixExclusive = true' are mutually incompatible.

See also
IndexEntryComparison::makeQueryObject

Public Attributes

BSONObj keyPrefix
 
int prefixLen = 0
 Use this many fields in 'keyPrefix'. More...
 
bool prefixExclusive = false
 If true, compare exclusively on just the fields on keyPrefix and ignore the suffix. More...
 
std::vector< const BSONElement * > keySuffix
 Elements starting at index 'prefixLen' are logically appended to the prefix. More...
 
std::vector< bool > suffixInclusive
 If the ith element is false, ignore indexes > i in keySuffix and treat the concatenated key as exclusive. More...
 

Member Data Documentation

◆ keyPrefix

BSONObj mongo::IndexSeekPoint::keyPrefix

◆ keySuffix

std::vector<const BSONElement*> mongo::IndexSeekPoint::keySuffix

Elements starting at index 'prefixLen' are logically appended to the prefix.

The elements before index 'prefixLen' should be ignored.

◆ prefixExclusive

bool mongo::IndexSeekPoint::prefixExclusive = false

If true, compare exclusively on just the fields on keyPrefix and ignore the suffix.

◆ prefixLen

int mongo::IndexSeekPoint::prefixLen = 0

Use this many fields in 'keyPrefix'.

◆ suffixInclusive

std::vector<bool> mongo::IndexSeekPoint::suffixInclusive

If the ith element is false, ignore indexes > i in keySuffix and treat the concatenated key as exclusive.

The elements before index 'prefixLen' should be ignored.

Must have identical size as keySuffix.


The documentation for this struct was generated from the following file: