Пример #1
0
        void buildCollection() {
            BSONObj info;
            // Create a collection with specified extent sizes
            BSONObj command = BSON( "create" << collname() << "capped" << true <<
                                    "$nExtents" << extentSizes() << "autoIndexId" << false );
            ASSERT(client()->runCommand(dbname(), command, info));

            // Populate documents.
            for(int i = 0; i < numDocs(); ++i) {
                client()->insert(ns(), BSON( "_id" << i << "ts" << i << "payload" << payload8k() ));
            }
        }
 /**
  * Increases a document's size dramatically such that the document
  * exceeds the available padding and must be moved to the end of
  * the collection.
  */
 void forceDocumentMove() {
     BSONObj query = BSON("_id" << 2);
     BSONObj updateSpec = BSON("$set" << BSON("payload" << payload8k()));
     update(query, updateSpec);
 }