src/mongo/db/repl/sync_tail_test.cpp
/**
 * Create test collection.
 * Returns collection.
 */
Create test collection.
Returns collection.
Create test collection . Returns collection .
void createCollection(OperationContext* opCtx,
                      const NamespaceString& nss,
                      const CollectionOptions& options) {
    writeConflictRetry(opCtx, "createCollection", nss.ns(), [&] {
        Lock::DBLock dblk(opCtx, nss.db(), MODE_X);
        OldClientContext ctx(opCtx, nss.ns());
        auto db = ctx.db();
        ASSERT_TRUE(db);
        mongo::WriteUnitOfWork wuow(opCtx);
        auto coll = db->createCollection(opCtx, nss.ns(), options);
        ASSERT_TRUE(coll);
        wuow.commit();
    });
}
void createCollection ( OperationContext * opCtx , const NamespaceString & nss , const CollectionOptions & options ) { writeConflictRetry ( opCtx , " " , nss . ns ( ) , [ & ] { Lock :: DBLock dblk ( opCtx , nss . db ( ) , MODE_X ) ; OldClientContext ctx ( opCtx , nss . ns ( ) ) ; auto db = ctx . db ( ) ; ASSERT_TRUE ( db ) ; mongo :: WriteUnitOfWork wuow ( opCtx ) ; auto coll = db -> createCollection ( opCtx , nss . ns ( ) , options ) ; ASSERT_TRUE ( coll ) ; wuow . commit ( ) ; } ) ; }
Create test collection.
Create test collection .