Voting for one of four candidates

Hi folks, I am trying to see if this is possible. It may very well not be…let me ask.

So imagine you have 10 districts and each district has 4 candidates…and you want a user to vote for ONE of the 4 candidates.

Q1: How do I allow anonymous users to vote? I don’t need users to log in or sign up to vote
Q2: I was experimenting with this but I can’t seem to create the database in a way to allow a Vote button to register a vote for one candidate for one district.

I have these collections:



If you remove the login / signup screens from your app, then non-registered/anonymous users will be able to use it.

You could have a list of districts, and when the user clicks on a district, they are taken to a screen with a list of the candidates for the current district. That list of candidates can have a vote button. The vote button can have an action that creates a vote record. (Your votes collection should have a relationship to the candidate)

Thanks Ben. I was trying it like that but not getting through. Going down infinite recursion…

This is how I have Votes setup:

I think you would want to make it so that a vote record is only associated to one candidate, and clicking on the vote button creates a vote record.