I want to push some values into array using Python.
Maybe next time when i update the array ,it will insert some values exists ,so it will got some duplicate values.
I want to know is there anyway to avoid duplicate values.
Should I use db.collection.find() to determine whether I should insert 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}})