So I'm making a simple pizza-voting app with Flask and Mongoengine. Here's the class for votes document:
class Votes(db.Document):
# reference to a date the vote started
vote = db.ReferenceField(VoteArchive)
# reference to one kind of pizza
pizza = db.ReferenceField(Pizza)
# list of references to users that voted for that pizza
voters = db.ListField(db.ReferenceField(User))
What I'm unable to figure out is how to make references in 'voters' to be unique. NOT the whole field but items in that list not to repeat, so one user could vote for one pizza only once.
The goal is to forbid one user to vote for a pizza twice.
Any ideas?