I have a class in mongoengine
class Post(EmbeddedDocument):
uid = StringField(required=True)
text = StringField(required=True)
value = StringField()
class Feed(Document):
label = StringField(required=True)
feed_url = StringField(required=True)
posts = ListField(EmbeddedDocumentField(Post))
I am trying to update the Post
EmbeddedDocument
property name text from a certain "Parent" document.
As a first step, I retrieve the Feed Document
model = Feed.objects(_id="....").first()
and then I want to update the property text of the embedded document "Post".
How can I achieve it with mongoengine?
I resolved it :)
Feed.objects(_id="...", posts__text="findvalue").update(set__posts__S__value="updatevalue")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With