README.rdoc in voteable_mongo-0.9.1 vs README.rdoc in voteable_mongo-0.9.2
- old
+ new
@@ -1,16 +1,31 @@
= Voteable Mongo
-voteable_mongo allows you to make your Mongoid::Document or MongoMapper::Document objects voteable (up or down) and tabulate votes count and votes point for you. For instance, in a forum, a user can vote up (or down) on a post or a comment.
+voteable_mongo allows you to make your Mongoid::Document or MongoMapper::Document objects voteable and tabulate votes count and votes point for you. For instance, in a forum, a user can vote up (or down) on a post or a comment. It's optimized for speed by using only ONE database request per collection to validate, update, and retrieve updated data.
-voteable_mongo is built for speed. It uses only one database request per collection to validate data, update data, and get updated data. Initial idea is based on http://cookbook.mongodb.org/patterns/votes
+Initial idea based on http://cookbook.mongodb.org/patterns/votes
Sample app at https://github.com/vinova/simple_qa
-Benchmarks at https://github.com/vinova/voteable_benchmarks
+Wonder how fast voteable_mongo is compare to other SQL & MongoDB solutions?
+Visit benchmarks at https://github.com/vinova/voteable_benchmarks
-=== Sites using voteable_mongo
+== Why voteable_mongo?
+
+There are various solution for up / down voting problem (see list below)
+* https://github.com/medihack/make_voteable
+* https://github.com/brady8/thumbs_up
+* https://github.com/icaruswings/mm-voteable
+* https://github.com/jcoene/mongoid_voteable
+
+Most of them using additional votes table (SQL) or votes collection (MongoDB) to store votes and do data tabulation on that votes table or votes collection.
+
+voteable_mongo is different. It can do much more with a single request to MongoDB database. It takes advantage of document-oriented database to store all related votes data inside voteable document do you don't have to maintain additional collection. When do vote up, vote down, revote, unvote, voteable_mongo validates vote data, updates voteable document data and retrieves updated data using only ONE database request (thanks to atomic find_and_modify operation). When voteable document is loaded, all votes data related to it also be loaded, no more additional database requests to see how many votes this document got?, who give up votes? who give down vote? total vote points, votes count ...
+
+So use voteable_mongo and save your database requests for other other tasks.
+
+== Sites using voteable_mongo
* http://www.amorveneris.com
* http://zheye.org (https://github.com/huacnlee/quora)
== Installation
@@ -106,11 +121,11 @@
Is equivalent to
@user.vote(:votee => @post, :value => :up)
@post.vote(:voter => @user, :value => :up)
In case you don't need to init voter and / or votee objects you can
- @user.vote(:votee_type => 'Post', :votee_id => post_id, :value => :down)
+ @user.vote(:votee_class => Post, :votee_id => post_id, :value => :down)
@post.vote(:voter_id => user_id, :value => :up)
Post.vote(:voter_id => user_id, :votee_id => post_id, :value => :up)
=== Undo a vote
@@ -130,18 +145,18 @@
Note: vote function always return updated votee object
=== Get vote_value
@user.vote_value(@post)
- @user.vote_value(:class_type => 'Post', :votee_id => post_id)
+ @user.vote_value(:votee_class => Post, :votee_id => post_id)
@post.vote_value(@user)
@post.vote_value(user_id)
=== Check if voted?
@user.voted?(@post)
- @user.voted?(:class_type => 'Post', :votee_id => post_id)
+ @user.voted?(:votee_class => Post, :votee_id => post_id)
@post.voted_by?(@user)
@post.voted_by?(user_id)
=== Get votes counts and points
@@ -178,18 +193,18 @@
Rails
rake mongo:voteable:init_stats
Ruby
Mongo::Voteable::Tasks::init_stats
-=== Migrate from version < 0.7.0
+=== Migrate from voteable_mongoid version < 0.7.0
Rails
rake mongo:voteable:migrate_old_votes
Ruby
Mongo::Voteable::Tasks.migrate_old_votes
== Credits
-* Alex Nguyen (alex@vinova.sg) - Author
-* Stefan Nguyen (stefan@vinova.sg) - Unvoting
+* Alex Nguyen - Author
+* https://github.com/vinova/voteable_mongo/contributors
-Copyright (c) 2010-2011 Vinova Pte Ltd (http://vinova.sg)
+Copyright (c) 2010-2011 Vinova Pte Ltd
Licensed under the MIT license.