I am trying to unset certain fields based on the name of the field (the key).
Say I have something like this:
{
5: "cool",
93: "cool",
30: "cool",
56: "cool"
}
How would I unset all fields with a value below, say, 40.
So the result should be:
{
5: "cool",
30: "cool"
}
I tried using the less than command on the whole field or using the positional operator but both of those failed.
collection.update_one(
{"_id": id},
{"$unset": {"blacklist.$": {"$lt": 40}}}
)
I couldn't find anything online or on the docs so I am hoping to find some help here,
Thanks!