okay, i found a solution.
thanks to mike and his very modular design of the pymongo driver. i've
overwritten the ObjectIdInjector to use the hex representation of the
ID, not the binary one. maybe this is a bit slower, but much more
easier to handle for me :)
from pymongo.connection import Connection
from pymongo.son_manipulator import SONManipulator
from pymongo.objectid import ObjectId
db_conn = Connection().test
class ObjectIdInjector(SONManipulator):
def transform_incoming(self, son, collection):
if not '_id' in son:
son['_id'] = ObjectId().url_encode()
return son
db_conn.add_son_manipulator(ObjectIdInjector())
db_conn.test.remove({})
id = db_conn.test.save({'a': 123})
print id
a = db_conn.test.find_one({})
b = db_conn.test.find_one({'_id': id})
assert a == b