[SERVER-9066] Field names can be repeated in JavaScript when the same value is set multiple times Created: 21/Mar/13  Updated: 11/Jul/16  Resolved: 01/Apr/13

Status: Closed
Project: Core Server
Component/s: JavaScript, MapReduce
Affects Version/s: 2.4.0
Fix Version/s: 2.4.2, 2.5.0

Type: Bug Priority: Major - P3
Reporter: Ben Becker Assignee: Ben Becker
Resolution: Done Votes: 0
Labels: javascript, mapreduce
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File mr_jsonly_test.js    
Issue Links:
Duplicate
is duplicated by SERVER-9442 Query results edited in javascript ca... Closed
is duplicated by SERVER-9353 Duplicate keys in stored and shell ob... Closed
Related
is related to SERVER-8624 Remove read-only constraint on Reduce... Closed
Operating System: ALL
Steps To Reproduce:

Run attached 'mr_jsonly_test.js' script, then mongodump -d test -c jwc_test

Participants:

 Description   

In SERVER-8624, we switched to a mutable argument flag for invoke(). The goal was to make it possible to utilize the function argument directly instead of having to perform a deep copy.

When manipulating one of these arguments, some properties added to the argument appear in the result set with duplicate field names (when running with jsMode:false).

http://groups.google.com/group/mongodb-user/browse_thread/thread/8dc58c951e26a085



 Comments   
Comment by auto [ 01/Apr/13 ]

Author:

{u'date': u'2013-04-01T19:21:53Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}

Message: SERVER-9066: avoid duplicate JS field names
Branch: v2.4
https://github.com/mongodb/mongo/commit/f1017ee04454faace5997a3604527d3fd6bccda9

Comment by auto [ 01/Apr/13 ]

Author:

{u'date': u'2013-04-01T19:21:53Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}

Message: SERVER-9066: avoid duplicate JS field names
Branch: master
https://github.com/mongodb/mongo/commit/d2febea6d4a66998682467aa0e4adc0d55365166

Comment by Ben Becker [ 30/Mar/13 ]

Issue was that BSONHolder::_extra was an stl list, so there was nothing preventing duplicate entries. This happens when, for example, the same property is set multiple times on an object. The resulting BSON then contains repeated elements.

Generated at Thu Feb 08 03:19:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.