Answer the question
In order to leave comments, you need to log in
How to find the position of an item in a PyMongo list?
Greetings, how to find the position of an item and refer to it ($pull) in a list (Array)?
Example:
list1 = collection_name.find_one({"_id": ...})["Список"]
collection_name.update_one({"_id": ...}, {"$pull": {"list": ...}})
Answer the question
In order to leave comments, you need to log in
If this is an array of strings, then you need to specify the desired value
collection_name.update_one({"_id": ...}, {"$pull": {"list": "Позиция 0"}})
collection_name.update_one({_id: ..., "list": "Позиция 0"}, {"$set: {"list.$": "Позиция 00"}})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question