当前位置: 首页>>代码示例>>C++>>正文


C++ UpdateIndexData类代码示例

本文整理汇总了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" ) );
 }
开发者ID:3rf,项目名称:mongo,代码行数:7,代码来源:update_index_data_test.cpp

示例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);
}
开发者ID:vnvizitiu,项目名称:mongo,代码行数:43,代码来源:current_date_node_test.cpp

示例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);
}
开发者ID:vnvizitiu,项目名称:mongo,代码行数:40,代码来源:addtoset_node_test.cpp


注:本文中的UpdateIndexData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。