diff options
author | Jason Carey <jcarey@argv.me> | 2015-09-23 11:11:40 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2015-10-06 19:28:19 -0400 |
commit | b7104c6f2f597335c6b9890ff6b80243625a6258 (patch) | |
tree | 8107d9b98344574c7bd541619c1fcb5b727b0eb2 /src/mongo/scripting/mozjs/cursor.cpp | |
parent | e5f65d77a33e5116adb965549deb51ab3ed0a462 (diff) | |
download | mongo-b7104c6f2f597335c6b9890ff6b80243625a6258.tar.gz |
SERVER-20564 no default getOwned for BSON in JS
Diffstat (limited to 'src/mongo/scripting/mozjs/cursor.cpp')
-rw-r--r-- | src/mongo/scripting/mozjs/cursor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/cursor.cpp b/src/mongo/scripting/mozjs/cursor.cpp index 79c1f5cf749..072e2ffb999 100644 --- a/src/mongo/scripting/mozjs/cursor.cpp +++ b/src/mongo/scripting/mozjs/cursor.cpp @@ -83,7 +83,9 @@ void CursorInfo::Functions::next::call(JSContext* cx, JS::CallArgs args) { BSONObj bson = cursor->next(); bool ro = o.hasField("_ro") ? o.getBoolean("_ro") : false; - ValueReader(cx, args.rval()).fromBSON(bson, ro); + // getOwned because cursor->next() gives us unowned bson from an internal + // buffer and we need to make a copy + ValueReader(cx, args.rval()).fromBSON(bson.getOwned(), nullptr, ro); } void CursorInfo::Functions::hasNext::call(JSContext* cx, JS::CallArgs args) { |