I have a document and an embedded document using MongoEngine
class Sub(EmbeddedDocument):
Id = StringField()
User = StringField()
Value = StringField()
class Main(Document):
Value = StringField
Values = ListField(EmbeddedDocumentField(Sub))
When I add new embedded documents to the main "Values" field, I generate a unique identifier in the list, and not in the collection, maybe several Sub in the main "values" of each of different users, I try to get MongoEngine to atomically remove the "Sub" value from the list based on identifier and user.
I tried running select for Main and then update_one for Sub itself
Main.objects(id=main_id).update_one(pull__values__id=sub_id)
, , . , Main, Values, , - sub pull, iterate, update.