I have a document in mongoDB like this :
{
"_id" : 0,
"name" : "Sponge Bob",
"values" : [ [10000, 90], [10001, 92] . . .],
"storages" : [{ "number" : 123, "timestamp": "2022-09-08"}, . . .],
"timestamp" : "2022-09-08"
}
I want to delete a filtered "storages"
objects filtered with a range date, the same thing to "values"
, but with the number on the first element of the array.
I've trying to do something like :
objects.update({"_id":1}, {"$pull" : {"timestamp" :{"$gt": date}}})
But I do realize that the "$pull"
method in this case will not catch all the array of an object, but indeed all the document that will be filtered in that range filter.
So the question is : how do I do this kind of filter to this kind of elements inside the documents with pymongo ?