I want to push some values ββinto an array using Python.
Perhaps the next time I update the array, it inserts some values, so it will get multiple duplicate values.
I want to know, one way or another, to avoid duplicate values.
Should I use db.collection.find () to determine if I should embed or not?
db.graph.insert_one({"user_id": a.url}, ) for j in a.followers: db.graph.update({"user_id": a.url}, {"$push": {"following": j.url}})
source share