pymongo mapreduce db assertion failure -


I'm just starting with Mongo and map / minimize, and I come using the pymongo in the following error I'm not getting used to the Mongo command line (I know that this is such a question but I find a lot more basic).

I am using the example directly from Pimango Documentation:

Pymongo.code import code db = connection () from pymongo import connection. Map_reduce_example db.things.insert ({"x": 1, "tag": ["dog", "cat"]}} db.things.insert ({"x": 2, "tag": ["cat" ]} Db.things.insert ({"x": 3, "tag": ["mouse", "cat", "dog"]}) db.things.insert ({"x": 4, "tag ": (Function () {this.tags.forEach} (function (Z) {emit ('d, 1);});}") = code ("work" (emit 'Total' = (; var i = 0; i & lt; values.length; i ++) {total + = Value [i];} total return;} ") result = db.things.map_readuce (m, r)

This gives me the following error:

  Tracebacks (most recent call final): File "demo.py" Line 17, & lt; module & gt; results = db.things.map_readuce (m, r) file "/usr/local/lib/python2.6/dist-packages/pymongo-1.9-py2.6-linux-i686 .egg / pymongo / collection.py ", line 943, map_reduce map = map, decrease, decrease, ** kwargs) file" /usr/local/lib/python2.6/dist-packages/pymongo-1.9- Py2.6-linux-i686.egg / pymongo / Database.py ", line 293, command msg, acceptable_rorsures) file" /usr/local/lib/python2.6/dist-packages/pymongo-1.9-py2.6- Linux-i686.egg / pymongo / helpers.py ", line 119, _check_command_response, increase operation files (msg% response [" errmsg "]) pymongo.errors.OperationFailure: order son ([('[Maprades', 'Euthanas'], ('Map', code ("work () (value ('kut Te ", 1);}", {}), ( 'low', the code ( "function (key, value) {var total = 0; (Var i = 0; i & lt; values; however, altogether;} returned an integer;} ', {}))]) failed: db representation failure   

However, Define / minimize works in mono and the following command works:

  db.things.mapReduce (mm, r, {out: {inline: 1}})   

Define the difference {out: {inline: 1}}. What is the way to call Pimango?

Thanks,

Adam.

The problem is related to the 'out' parameter. To begin with MongoDB 1.7.4, the 'out' parameter is required, you must always specify the name of the output collection when using map_rends.

  results = db.things.map_readuce (m, r, "output_out_name_name")   

if you want to complete your map display in memory Instead call inline_map_rends.

  Results = db.things.inline_map_reduce (m, r)   

The above examples only work with the latest version of pymongo, directly from the GIT repository met. Pymongo 1.9 MongoDB does not work well with 1.7.4 or best.

Comments