pymongo.errors.OperationFailure: database error: Can't canonicalize query: BadValue unknown operator: $set

783 views Asked by At

In pymongo, I use find_one() to query and got a document. Then I use this doc to find_one(doc) again, I got this error.

pymongo.errors.OperationFailure: database error: Can't canonicalize query: BadValue unknown operator: $set

The document I got looks like this:

{
     u'_id': ObjectId('55768a989e7d5216a4a35e9a'),
     u'h': -5393879121411301345L,
     u'ts': Timestamp(1433739200, 23),
     u'o': {
         u'$set': {
             u'last_update_time': 1433739200.163728,
             u'value': 0,
             u'lv': 10,
             u'times': 30
         }
     },
     u'v': 2,
     u'ns': u'db.mycol',
     u'o2': {
         u'_id': 1234567
     },
     u'op': u'u'
}

What's more, If i want to use the returned document to query agian, what should I do to parse the document?

0

There are 0 answers