How to manually create a DBRef using pymongo?

Posted by Soviut on Stack Overflow See other posts from Stack Overflow or by Soviut
Published on 2010-06-16T20:08:39Z Indexed on 2010/06/16 20:12 UTC
Read the original article Hit count: 307

Filed under:
|
|
|

I want to create a DBRef manually so that I can add an additional field to it. However, when I try to pass the following:

{'$ref': 'projects', '$id': '1029412409721', 'project_name': 'My Project'}

Pymongo raises an error:

pymongo.errors.InvalidName: key '$id' must not start with '$'

It would seem that pymongo reserve the $ for the special key, leading me to wonder if it is even possible to do what I'm trying to do?

© Stack Overflow or respective owner

Related posts about python

Related posts about mongodb