How would I do this with fuel:
// Get the user id who's voting
user_id = ObjectId("4bcc9e697e020f2d44471a15");
// This query succeeds only if the voters array doesn't contain the user
query = {_id: ObjectId("4bcc9e697e020f2d44471d27"), voters: {'$ne': user_id});
// Update to add the user to the array and increment the number of votes.
update = {'$push': {'voters': user_id}, '$inc': {vote_count: 1}}
db.stories.update(query, update);
And help would be greatly appreciated.
if you're having trouble with the converting json to arrays, try doing
print_r(json_decode({"a":"b"}....));
so you can see the array structure you need.
if its problems with updating using inc,
I wrote an article on how to use $inc, and other update params with fuelphp and mongo http://copypastecoder.tumblr.com/post/21581297064/how-to-use-inc-in-fuelphp-with-mongodb
To see a world in a granda of stand.And a heaven in a wild flower.Hold infinity in the palm your hand and eternity in an hour.Cheap WOW Gold or Buy RS Gold and Diablo 3 Items