[JAVA-500] m/r out:db and out:sharded options Created: 29/Dec/11  Updated: 19/Oct/16  Resolved: 29/Dec/11

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

Type: New Feature Priority: Major - P3
Reporter: Uladzimir Mihura Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: epam
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to JAVA-508 Add "out.*" support for MapReduceCommand Closed

 Description   

At this moment we can specify only MapReduceCommand.OutputType and collection name.

public MapReduceCommand(DBCollection inputCollection,
                        String map,
                        String reduce,
                        String outputCollection,
                        MapReduceCommand.OutputType type,
                        DBObject query)
                 throws MongoException

No way for this:

Additional options within out objects are:

  • "db" - the db name to output to.

     out : \{replace : "collectionName", db : "otherDB"\}

    { sharded : true} - MongoDB 1.9+ If true and combined with an output mode that writes to a collection, the output collection will be sharded using the _id field. See details in the sharding section.



 Comments   
Comment by Scott Hernandez (Inactive) [ 23/Jan/12 ]

yes, there would need to be a change to the code. I have create another issue to track that api change: JAVA-508

Comment by Peter Maedel [ 23/Jan/12 ]

looking at toDBObject.toDBObject() clearly shows that there the out.sharded option is never being added from nowhere.
so with this version of the mongo java driver it is not possible to trigger a map reduce job that will perform a sharded output...

why is this issue resolved?

Comment by Scott Hernandez (Inactive) [ 29/Dec/11 ]

Feel free to add a feature request. I don't think this method you describe is better or even and good idea; if anything we should make the MapReduceCommand a builder pattern and deprecate the existing method you first used in your example.

More docs are always better

Comment by Uladzimir Mihura [ 29/Dec/11 ]

ALso I think that MapReduceCommand can have the following constructor:

public MapReduceCommand(DBCollection inputCollection,
                        String map,
                        String reduce,
                        DBObject out,
                        DBObject query)
                 throws MongoException

-vova

Comment by Uladzimir Mihura [ 29/Dec/11 ]

Scott,

This is addExtraOption method?
It will be nice to this this in javadoc.

Thank you in advance.

-vova

Comment by Scott Hernandez (Inactive) [ 29/Dec/11 ]

You have to use MapReduceCommand version to do this.

http://api.mongodb.org/java/current/com/mongodb/DBCollection.html#mapReduce(com.mongodb.MapReduceCommand)

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