[JAVA-606] MapReduce Fails when specifying a collection name Created: 23/Jul/12  Updated: 29/Aug/12  Resolved: 23/Jul/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 2.9.0

Type: Bug Priority: Minor - P4
Reporter: Brendan W. McAdams Assignee: Brendan W. McAdams
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-497 ReadPrefs ignored for commands Closed

 Description   

Due to the new "obeyReadPreference" code, any mapReduce which tries to use a straight forward collection name for output fails.

The code is hardwired to cast "out" to a DBObject, which is counter to the docs/behavior of MongoDB.



 Comments   
Comment by Jeffrey Yemin [ 29/Aug/12 ]

Closing as part of 2.9.0 release process.

Comment by auto [ 23/Jul/12 ]

Author:

{u'date': u'2012-07-23T08:06:57-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-606: Added a test. Made check for inline a bit more lax.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/8a6a4b1442893f48cea724204f6141be424c646c

Comment by Jeffrey Yemin [ 23/Jul/12 ]

First part of fix: https://github.com/mongodb/mongo-java-driver/commit/5af9606ee95e191f7f244033881f165b982adadb.

Comment by Brendan W. McAdams [ 23/Jul/12 ]

RawMapReduce in the Scala driver can reproduce all of these issues.

Comment by Brendan W. McAdams [ 23/Jul/12 ]

For now, I am rewriting parts of the Scala driver to work around this as it is easier but it will likely break customer code. I advise we fix it.

Comment by Brendan W. McAdams [ 23/Jul/12 ]

Further, verbose is acceptable as both an int and a boolean.

We are hard casting to an int which means any code that sets it as a boolean (valid in the MongoDB Server) breaks.

The obeyReadPreference code is causing serious breakage because of this in the Scala driver, and probably in other third party drivers as well.

Comment by Jeffrey Yemin [ 23/Jul/12 ]

Note that this bug was introduced by the fix to JAVA-497, and does not appear in any release.

Comment by Brendan W. McAdams [ 23/Jul/12 ]

This occurs only when you construct a standalone DBObject command and invoke 'command'. The MapReduceCommand and mapReduce functions filter out any problem.

However, the docs/specs do allow "out" to contain a string with a collection name, and we should not have a DBObject class check.

Generated at Thu Feb 08 08:52:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.