can you maybe help me please? I'm making my voting system in php + mongodb, and I would like to keep the ip addresses which already voted. What would be to best way? I was thinking about doing it like this:
$ip=$_SERVER['REMOTE_ADDR'];
$ipData = array('$push' => array('ips' => $ip), '$inc' => array('votes' => 1));
$collection->update(array( '_id' => $id), $ipData);
Is this the best way to do it? How would you than compare all the elements of the ips
array to see if the ip already didn't voted? The list will look like (192.168.0.1, 127.0.0.1, 123.45.67.8)
.
Thank you!