ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

Creating a Simple and Efficient Rating System with MongoDB

A couple of tricks for using MongoDB’s $set operator, dealing with properties that contain dots for creating a basic rating system:

$set will set the value or update it. So you don’t have to worry about repeat voters! They simply will change their vote and not skew your results. If you don’t want the users to be able to vote twice then you can simply disable the link to vote on the page by looking for the IP in the array of ratings. Which, yes, is a simple deterrent and the user could technically lift the URL to hit to make the request to vote again…But again, your results aren’t skewed and if you need further protection you can come up with something else.

Atomic increments are not available in all NoSQL databases, so if your application needs it make sure you include it early on the checklist.

Original title and link: Creating a Simple and Efficient Rating System with MongoDB (NoSQL databases © myNoSQL)

via: http://www.shift8creative.com/blog/creating-a-simple-and-efficient-rating-system-with-mongodb