diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index af5babf..7db1014 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -463,6 +463,19 @@ namespace mongo { } + BSONObjIterator i(key); + while (i.more()) { + BSONElement e = i.next(); + if (e.isNumber()) { + double dval = e.number(); + if (dval != 1 && dval != -1) { + string s = str::stream() << "Must specify ascending/descending with 1 and -1, " + << "but found: " << e; + return Status( ErrorCodes::CannotCreateIndex, s ); + } + } + } + return Status::OK(); }