diff options
author | Mathias Stearn <mathias@10gen.com> | 2016-06-21 11:20:59 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2016-06-22 16:04:36 -0400 |
commit | 27a563f0c7adddebc6354dd6591e0849c86eaf64 (patch) | |
tree | 14dd347177f2aec22041791b811ef163fc95914e | |
parent | d74b549a87899dbd5fe347a1a08cdab0536daad2 (diff) | |
download | mongo-27a563f0c7adddebc6354dd6591e0849c86eaf64.tar.gz |
SERVER-24242 Don't create a vector<BSONElement> just to iterate
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index ef3c20448a4..e27ff0e2ae1 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -755,16 +755,14 @@ Status applyOperation_inlock(OperationContext* txn, if (fieldO.type() == Array) { // Batched inserts. - Status status{ErrorCodes::NotYetInitialized, ""}; - std::vector<BSONObj> insertObjs; - for (auto elem : fieldO.Array()) { + for (auto elem : fieldO.Obj()) { insertObjs.push_back(elem.Obj()); } WriteUnitOfWork wuow(txn); OpDebug* const nullOpDebug = nullptr; - status = collection->insertDocuments( + Status status = collection->insertDocuments( txn, insertObjs.begin(), insertObjs.end(), nullOpDebug, true); if (!status.isOK()) { return status; |