本文整理汇总了C++中UpdateIndexData类的典型用法代码示例。如果您正苦于以下问题:C++ UpdateIndexData类的具体用法?C++ UpdateIndexData怎么用?C++ UpdateIndexData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateIndexData类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST( UpdateIndexDataTest, Simple2 ) {
UpdateIndexData a;
a.addPath( "ab" );
ASSERT_FALSE( a.mightBeIndexed( "a" ) );
a.clear();
ASSERT_FALSE( a.mightBeIndexed( "ab" ) );
}
示例2: TEST_F
TEST_F(CurrentDateNodeTest, ApplyIndexesNotAffected) {
auto update = fromjson("{$currentDate: {a: true}}");
const CollatorInterface* collator = nullptr;
CurrentDateNode node;
ASSERT_OK(node.init(update["$currentDate"]["a"], collator));
Document doc(fromjson("{a: 0}"));
FieldRef pathToCreate("");
FieldRef pathTaken("a");
StringData matchedField;
auto fromReplication = true;
auto validateForStorage = true;
FieldRefSet immutablePaths;
UpdateIndexData indexData;
indexData.addPath("b");
Document logDoc;
LogBuilder logBuilder(logDoc.root());
auto indexesAffected = false;
auto noop = false;
node.apply(doc.root()["a"],
&pathToCreate,
&pathTaken,
matchedField,
fromReplication,
validateForStorage,
immutablePaths,
&indexData,
&logBuilder,
&indexesAffected,
&noop);
ASSERT_FALSE(noop);
ASSERT_FALSE(indexesAffected);
ASSERT_EQUALS(doc.root().countChildren(), 1U);
ASSERT_TRUE(doc.root()["a"].ok());
ASSERT_EQUALS(doc.root()["a"].getType(), BSONType::Date);
ASSERT_EQUALS(logDoc.root().countChildren(), 1U);
ASSERT_TRUE(logDoc.root()["$set"].ok());
ASSERT_EQUALS(logDoc.root()["$set"].countChildren(), 1U);
ASSERT_TRUE(logDoc.root()["$set"]["a"].ok());
ASSERT_EQUALS(logDoc.root()["$set"]["a"].getType(), BSONType::Date);
}
示例3: TEST
TEST(AddToSetNodeTest, ApplyRespectsCollationFromSetCollator) {
auto update = fromjson("{$addToSet: {a: {$each: ['abc', 'ABC', 'def', 'abc']}}}");
const CollatorInterface* binaryComparisonCollator = nullptr;
AddToSetNode node;
ASSERT_OK(node.init(update["$addToSet"]["a"], binaryComparisonCollator));
const CollatorInterfaceMock caseInsensitiveCollator(
CollatorInterfaceMock::MockType::kToLowerString);
node.setCollator(&caseInsensitiveCollator);
Document doc(fromjson("{a: []}"));
FieldRef pathToCreate("");
FieldRef pathTaken("a");
StringData matchedField;
auto fromReplication = true;
auto validateForStorage = true;
FieldRefSet immutablePaths;
UpdateIndexData indexData;
indexData.addPath("a");
Document logDoc;
LogBuilder logBuilder(logDoc.root());
auto indexesAffected = false;
auto noop = false;
node.apply(doc.root()["a"],
&pathToCreate,
&pathTaken,
matchedField,
fromReplication,
validateForStorage,
immutablePaths,
&indexData,
&logBuilder,
&indexesAffected,
&noop);
ASSERT_FALSE(noop);
ASSERT_TRUE(indexesAffected);
ASSERT_EQUALS(fromjson("{a: ['abc', 'def']}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: ['abc', 'def']}}"), logDoc);
}