Edwardr
unread,Feb 8, 2012, 10:58:38 AM2/8/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MongoEngine Users
Hi,
Getting a strange error when I try and run item_frequencies on an
optional StringField() within a document that directly inherits from
Document. I know that a large portion of the documents in the
collection do not have the field present.
Firstly, when I execute Collection.item_frquencies('required_field'),
i.e., on a field I know has a value in every document the function
works fine, but when I change the field to an optional field I keep
getting the following error:
Traceback (most recent call last):
File "products.py", line 126, in <module>
res = Product.objects().item_frequencies('part_origin')
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
mongoengine-0.5.1-py2.7.egg/mongoengine/queryset.py", line 1521, in
item_frequencies
return self._item_frequencies_map_reduce(field,
normalize=normalize)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
mongoengine-0.5.1-py2.7.egg/mongoengine/queryset.py", line 1551, in
_item_frequencies_map_reduce
for f in values:
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
mongoengine-0.5.1-py2.7.egg/mongoengine/queryset.py", line 957, in
map_reduce
results = getattr(self._collection, map_reduce_function)(map_f,
reduce_f, **mr_args)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
pymongo/collection.py", line 1073, in inline_map_reduce
out={"inline": 1}, **kwargs)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
pymongo/database.py", line 340, in command
msg, allowable_errors)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/
pymongo/helpers.py", line 125, in _check_command_response
raise OperationFailure(ex_msg, response.get("assertionCode"))
pymongo.errors.OperationFailure: db assertion failure, assertion:
'assertion db/commands/mr.cpp:400'
Any ideas? Thanks!