void run() { const int expected = 100; drop(); addInserts(100); applyOplog(); ASSERT_EQUALS(expected, static_cast<int>(client()->count(ns()))); drop(); addVersionedInserts(100); applyOplog(); ASSERT_EQUALS(expected, static_cast<int>(client()->count(ns()))); drop(); addUpdates(); applyOplog(); BSONObj obj = findOne(); ASSERT_EQUALS(1334813340, obj["requests"]["1000001_2"]["timestamp"].number()); ASSERT_EQUALS(1334813368, obj["requests"]["1000002_2"]["timestamp"].number()); ASSERT_EQUALS(1334810820, obj["requests"]["100002_1"]["timestamp"].number()); drop(); }
void run() { const int expected = 100; drop(); addInserts(100); applyOplog(); ASSERT_EQUALS(expected, static_cast<int>(client()->count(ns()))); drop(); addVersionedInserts(100); applyOplog(); ASSERT_EQUALS(expected, static_cast<int>(client()->count(ns()))); drop(); addUpdates(); applyOplog(); BSONObj obj = findOne(); ASSERT_EQUALS(1334813340, obj["requests"]["1000001_2"]["timestamp"].number()); ASSERT_EQUALS(1334813368, obj["requests"]["1000002_2"]["timestamp"].number()); ASSERT_EQUALS(1334810820, obj["requests"]["100002_1"]["timestamp"].number()); drop(); // test converting updates to upserts but only for version 2.2.1 and greater, // which means oplog version 2 and greater. addConflictingUpdates(); applyOplog(); drop(); }
void addUniqueIndex() { addOp("i", BSON("ns" << ns() << "key" << BSON("x" << 1) << "name" << "x1" << "unique" << true), 0, "unittests.system.indexes"); addInserts(2); }