current_user.pk
has ObjectId
type (just id, no info about collection).
current_user
has LocalProxy
type.
You can't save reference as ObjectId
because there are no information about reference collection and mongo use for this BDRef
.
You can get DBRef
object from mongoengine document with Document.to_dbref
method.
So mognoenginge check type to get DBRef
explicitly or get it from document with to_dbref
.
For current_user
you can call to_dbref
to get DBRef
object or _get_current_object()
to get real User
object.