There are likely corrupt records in the collection you are querying.
You should run validate on the collection:
http://docs.mongodb.org/manual/reference/commands/#validate
db.<collection name>.validate(true) in the mongo shell. Be aware, this
is a resource intensive operation and will impact performance.
On Thu, Oct 4, 2012 at 1:40 PM, Bogdan <
vasi...@gmail.com> wrote:
> I am trying to query a MongoDB database using Python 2.7 and pymongo-2.3
> using something like this:
>
> from pymongo import Connection
>
> connection = Connection()
> db = connection['db-name']
> collections = db.subName
> entries = collections['collection-name']
> print entries
> # > Collection(Database(Connection('localhost', 27017), u'db-name'),
> u'subName.collection-name')
>
> for entry in entries.find():
> pass
>
> The iterator fails even though I don't do anything with the entry objects:
>
> Traceback (most recent call last):
> File "/Users/../mongo.py", line 27, in <module>
> for entry in entries.find():
> File
> "/Library/Python/2.7/site-packages/pymongo-2.3-py2.7-macosx-10.8-intel.egg/pymongo/cursor.py",
> line 778, in next
> File
> "/Library/Python/2.7/site-packages/pymongo-2.3-py2.7-macosx-10.8-intel.egg/pymongo/cursor.py",
> line 742, in _refresh
> File
> "/Library/Python/2.7/site-packages/pymongo-2.3-py2.7-macosx-10.8-intel.egg/pymongo/cursor.py",
> line 686, in __send_message
> File
> "/Library/Python/2.7/site-packages/pymongo-2.3-py2.7-macosx-10.8-intel.egg/pymongo/helpers.py",
> line 111, in _unpack_response
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xfc in position 744:
> invalid start byte
>
> I'm not the creator of the database I'm trying to query. Does anybody know
> what I'm doing wrong and how I can fix it? Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to
mongod...@googlegroups.com
> To unsubscribe from this group, send email to
>
mongodb-user...@googlegroups.com
> See also the IRC channel --
freenode.net#mongodb