Note that there are some explanatory texts on larger screens.

plurals
  1. POAcessing inner element of json array from mapreduce
    text
    copied!<p>My sample Json object is as follows</p> <pre><code>{ "numRecommenders": 0, "publicProfileUrl": "http://www.linkedin.com/pub/heena-vyas/16/786/826", "positions": { "total": 1, "positionList": [ { "id": "91286566", "title": "senior executive", "company": { "name": "Reliance", "industry": "Oil &amp; Energy", "type": "Public Company", "size": "10,001+ employees" }, "isCurrent": true } ] }, </code></pre> <p>My mapreduce function is give below:</p> <pre><code>String map = "function() {" +"for (index in this.positions.positionList) {" +"emit(this.positions.positionList[index].company.name, {count: 1});" +"}}"; String reduce = "function(key, values) {" + "var sum = 0;" + "values.forEach(function(value) {" + "sum += value['count'];" + "});" + "return {count: sum};" + "};"; MapReduceCommand mapReduceCommand = new MapReduceCommand( mongoCollection, map, reduce.toString(), null, MapReduceCommand.OutputType.INLINE, null); MapReduceOutput out = mongoCollection.mapReduce(mapReduceCommand); </code></pre> <p>But current I'm working with 1.5 million objects from mongoDb.</p> <h2>I'm getting the following exception..</h2> <p>Exception in thread "main" com.mongodb.CommandResult$CommandFailure: command failed [command failed [mapreduce] { "assertion" : "too much data for in memory map/reduce" , "assertionCode" : 13604 , "errmsg" : "db assertion failure" , "ok" : 0.0} at com.mongodb.CommandResult.getException(CommandResult.java:70) at com.mongodb.CommandResult.throwOnError(CommandResult.java:116) at com.mongodb.DBCollection.mapReduce(DBCollection.java:961) at com.mongo.dboperations.MongoStorage.runGroupCommand(MongoStorage.java:126)</p> <h2> at com.mongo.dboperations.MongoStorage.main(MongoStorage.java:218)</h2> <p>How to resolve this exception?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload