diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2020-12-15 18:45:27 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-12-16 00:12:06 +0000 |
commit | 356787c1f465d35fa17aa2e7e6fd7e2ba09ce998 (patch) | |
tree | 41de8badc582919522916353ae882e282240cef2 /src/mongo/scripting/mozjs/bson.cpp | |
parent | e9ba0db9a0b5f4e7116670118cf10184a14f2e40 (diff) | |
download | mongo-356787c1f465d35fa17aa2e7e6fd7e2ba09ce998.tar.gz |
Revert "SERVER-52545 Define listIndexes with IDL"
This reverts commit 0c132588e9907c7b123f986a61c3a43cd087381f.
Diffstat (limited to 'src/mongo/scripting/mozjs/bson.cpp')
-rw-r--r-- | src/mongo/scripting/mozjs/bson.cpp | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/mongo/scripting/mozjs/bson.cpp b/src/mongo/scripting/mozjs/bson.cpp index efe78d2feab..0585022615a 100644 --- a/src/mongo/scripting/mozjs/bson.cpp +++ b/src/mongo/scripting/mozjs/bson.cpp @@ -31,7 +31,6 @@ #include "mongo/scripting/mozjs/bson.h" #include <boost/optional.hpp> -#include <fmt/format.h> #include <set> #include "mongo/scripting/mozjs/idwrapper.h" @@ -45,13 +44,10 @@ namespace mongo { namespace mozjs { -using namespace fmt::literals; - const char* const BSONInfo::className = "BSON"; -const JSFunctionSpec BSONInfo::freeFunctions[5] = { +const JSFunctionSpec BSONInfo::freeFunctions[4] = { MONGO_ATTACH_JS_FUNCTION(bsonWoCompare), - MONGO_ATTACH_JS_FUNCTION(bsonUnorderedFieldsCompare), MONGO_ATTACH_JS_FUNCTION(bsonBinaryEqual), MONGO_ATTACH_JS_FUNCTION(bsonObjToArray), JS_FS_END, @@ -280,13 +276,9 @@ void BSONInfo::Functions::bsonObjToArray::call(JSContext* cx, JS::CallArgs args) ValueReader(cx, args.rval()).fromBSONArray(obj, nullptr, false); } -namespace { -void bsonCompareCommon(JSContext* cx, - JS::CallArgs args, - StringData funcName, - BSONObj::ComparisonRulesSet rules) { +void BSONInfo::Functions::bsonWoCompare::call(JSContext* cx, JS::CallArgs args) { if (args.length() != 2) - uasserted(ErrorCodes::BadValue, "{} needs 2 arguments"_format(funcName)); + uasserted(ErrorCodes::BadValue, "bsonWoCompare needs 2 arguments"); // If either argument is not proper BSON, then we wrap both objects. auto scope = getScope(cx); @@ -296,20 +288,7 @@ void bsonCompareCommon(JSContext* cx, BSONObj bsonObject1 = getBSONFromArg(cx, args.get(0), isBSON); BSONObj bsonObject2 = getBSONFromArg(cx, args.get(1), isBSON); - args.rval().setInt32(bsonObject1.woCompare(bsonObject2, {}, rules)); -} -} // namespace - -void BSONInfo::Functions::bsonWoCompare::call(JSContext* cx, JS::CallArgs args) { - bsonCompareCommon(cx, args, "bsonWoCompare", BSONObj::ComparatorInterface::kConsiderFieldName); -} - -void BSONInfo::Functions::bsonUnorderedFieldsCompare::call(JSContext* cx, JS::CallArgs args) { - bsonCompareCommon(cx, - args, - "bsonWoCompare", - BSONObj::ComparatorInterface::kConsiderFieldName | - BSONObj::ComparatorInterface::kIgnoreFieldOrder); + args.rval().setInt32(bsonObject1.woCompare(bsonObject2)); } void BSONInfo::Functions::bsonBinaryEqual::call(JSContext* cx, JS::CallArgs args) { |