diff options
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r-- | src/mongo/db/dbhelpers.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index c247d31a6d1..9eec07c3fea 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -83,34 +83,6 @@ using std::stringstream; using logger::LogComponent; -void Helpers::ensureIndex(OperationContext* opCtx, - Collection* collection, - BSONObj keyPattern, - IndexDescriptor::IndexVersion indexVersion, - bool unique, - const char* name) { - BSONObjBuilder b; - b.append("name", name); - b.append("ns", collection->ns().ns()); - b.append("key", keyPattern); - b.append("v", static_cast<int>(indexVersion)); - b.appendBool("unique", unique); - BSONObj o = b.done(); - - MultiIndexBlock indexer(opCtx, collection); - - Status status = indexer.init(o).getStatus(); - if (status.code() == ErrorCodes::IndexAlreadyExists) - return; - uassertStatusOK(status); - - uassertStatusOK(indexer.insertAllDocumentsInCollection()); - - WriteUnitOfWork wunit(opCtx); - indexer.commit(); - wunit.commit(); -} - /* fetch a single object from collection ns that matches query set your db SavedContext first */ |