mongoengine- what do referencefield store

Viewed 7667

In mongoengine what value must be set into ReferenceField. I mean should we provide in "ObjectId" of the document to which the reference is to be made. For example,

class Bar(Document):
    content = StringField()
    foo = ReferenceField('Foo')

The object of class Bar should have what value set to in "foo" attribute. Should it be the ObjectId of some document in 'Foo' collection? Also can I set any other unique field as a value in reference field mentioning which field it is?

2 Answers
Related