I need to find a document in the collection of Chat
that contains no deal
field. According to the documentation exists
checks if the field exist, and first
, is used to retrieve the first result, but the next line
Chat.objects.first(deal__exists=False)
raises TypeError: first() got an unexpected keyword argument 'deal__exists'
That's the Chat
scheme
class Chat(Document):
id = IntField(primary_key=True)
name = StringField(default=CHANNEL_NAME)
invite_link = StringField(default=None)
deal = ReferenceField("Deal", default=None)
and current state of the only document in the collection:
{
"_id" : XXXXXXXXX,
"name" : "XXXXX",
"invite_link" : "https://t.me/joinchat/XXXXXXXXXXXXXXXXXXXXXX"
}
Value none
for the deal
gives the same result