README.rdoc in voteable_mongo-0.9.2 vs README.rdoc in voteable_mongo-0.9.3
- old
+ new
@@ -1,37 +1,40 @@
= Voteable Mongo
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.
-Initial idea 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
+Sample app at https://github.com/vinova/simple_qa.
Wonder how fast voteable_mongo is compare to other SQL & MongoDB solutions?
Visit benchmarks at https://github.com/vinova/voteable_benchmarks
== 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
+There are various solutions for up / down voting problem (1[https://github.com/medihack/make_voteable], 2[https://github.com/brady8/thumbs_up], 3[https://github.com/icaruswings/mm-voteable], 4[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.
-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 takes advantage of document-oriented database to store all related votes data inside voteable document. That has following benefits:
-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 ...
+* Don't have to maintain additional votes table or votes collection.
-So use voteable_mongo and save your database requests for other other tasks.
+* 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 ...
+* When vote up, vote down, revote, unvote, voteable_mongo validates vote data, updates voteable document and retrieves updated data using only ONE database request thanks to atomic findAndModify operation.
+
+* Atomic operations on single document warranty data integrity that makes sure if votes created / changed / deleted their associated counters and points will be updated.
+
+So use voteable_mongo for less maintain cost, data integrity and save database requests for other tasks.
+
== Sites using voteable_mongo
+* http://www.naiku.net
* http://www.amorveneris.com
-* http://zheye.org (https://github.com/huacnlee/quora)
+* http://zheye.org
== Installation
-=== Rails 3.0.x
+=== Rails 3.x
To install the gem, add this to your Gemfile
gem 'mongoid'
gem 'voteable_mongo'
@@ -181,30 +184,30 @@
Post.up_voted_by(@user)
Post.down_voted_by(@user)
== Utilities
-=== Re-generate counters and vote points in case you change :up / :down vote points
-Rails
- rake mongo:voteable:remake_stats
-Ruby
- Mongo::Voteable::Tasks.remake_stats
-
=== Set counters and point to 0 for uninitialized voteable objects in order sort and query
Rails
rake mongo:voteable:init_stats
Ruby
Mongo::Voteable::Tasks::init_stats
+=== Re-generate counters and vote points in case you change :up / :down vote points
+Rails
+ rake mongo:voteable:remake_stats
+Ruby
+ Mongo::Voteable::Tasks.remake_stats
+
=== 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 - Author
-* https://github.com/vinova/voteable_mongo/contributors
+* Contributors[https://github.com/vinova/voteable_mongo/contributors]
Copyright (c) 2010-2011 Vinova Pte Ltd
Licensed under the MIT license.