From 57bd9bd1d6f4903d78be8a8d106a2fae2a628be7 Mon Sep 17 00:00:00 2001 From: Jason Rassi Date: Mon, 19 May 2014 16:58:30 -0400 Subject: SERVER-13976 Cloner::go() fail fast if any collection has bad options (cherry picked from commit 7fced83ca52d18991b2729e2e518248b9e7c7887) --- src/mongo/db/cloner.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 10f911427d1..b7c029452e7 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -412,6 +412,16 @@ namespace mongo { LOG(2) << "\t cloner got " << collection << endl; + BSONElement collectionOptions = collection["options"]; + if ( collectionOptions.isABSONObj() ) { + Status parseOptionsStatus = CollectionOptions().parse(collectionOptions.Obj()); + if ( !parseOptionsStatus.isOK() ) { + errmsg = str::stream() << "invalid collection options: " << collection + << ", reason: " << parseOptionsStatus.reason(); + return false; + } + } + BSONElement e = collection.getField("name"); if ( e.eoo() ) { string s = "bad system.namespaces object " + collection.toString(); -- cgit v1.2.1