graphene-mongo
graphene-mongo copied to clipboard
How do embeded documents without `id`?
i've spend a week already to find some solution for this.
i have next mongo models:
class Inner(EmbeddedDocument):
meta = {
'strict': False,
}
foo = fields.StringField()
bar = fields.StringField()
class Outer(Document):
meta = {
"collection": "outer",
"auto_create_index": False,
'strict': False,
}
fizz = fields.StringField(unique=True)
inner = fields.EmbeddedDocumentField(Inner, default=None)
Graphene nodes:
class InnerGraph(MongoengineObjectType):
class Meta:
model = Inner
interfaces = (relay.Node,)
class OuterGraph(MongoengineObjectType):
class Meta:
model = Outer
interfaces = (relay.Node,)
And graphene query
class Query(ObjectType):
patient_list = MongoengineConnectionField(OuterGraph)
# some resolver - removing it change nothing
Outer entity working fine, as expected, no problems.
But inner entity has id field (which is not exists in first place)
~And no other fields~ fixed.
Output in docs. Query -> Outer (edges, node) -> inner (type: InnerGraph)
InnerGraph
Fields
id ID!
The ID of the object.
Implements
Node
An object with an ID (edited)
Any ideas, how to make this combination work?