Announcement Announcement Module
Collapse
No announcement yet.
Issue with calling a mapreduce in spring data mongo 1.0.3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with calling a mapreduce in spring data mongo 1.0.3

    Hey All I am trying to call the sample map reduce found on mongodb's site

    I get the following error with Java driver 2.7.1 and spring data 1.0.3-RELEASE

    DEBUG] [main 07:36:06] (MongoTemplate.java:mapReduce:997) Executing MapReduce on collection [testit], mapFunction [function () {
    for (var i = 0; i < this.x.length; i++) {
    emit(this.x[i], 1);
    }
    }
    ], reduceFunction [function (key, values) {
    var sum = 0;
    for (var i = 0; i < values.length; i++)
    sum += values[i];
    return sum;
    }]
    Exception in thread "main" java.lang.NoSuchMethodError: com.mongodb.DB.getOptions()I
    at org.springframework.data.mongodb.core.MongoTemplat e.mapReduce(MongoTemplate.java:1009)
    at org.springframework.data.mongodb.core.MongoTemplat e.mapReduce(MongoTemplate.java:971)

    The line in quesition is

    CommandResult commandResult = command.getOutputType() == MapReduceCommand.OutputType.INLINE ? executeCommand(commandObject, getDb().getOptions()) : executeCommand(commandObject);

  • #2
    Please check your dependency setup. 2.7.1 of the MongoDB Java driver definitely has the getOptions() method so you probably have an older version on the classpath.

    Comment

    Working...
    X