Best way to model a voting system in MongoDB

后端 未结 2 402
一整个雨季
一整个雨季 2020-12-24 10:01

I\'m trying to model a voting system in MongoDB. You could imagine it as a voting system similar to reddit. Requirements:

  1. Votes are connected to objects
相关标签:
2条回答
  • 2020-12-24 10:40

    Check out the Voting with Atomic Operators recipe in the Mongo Cookbook: http://cookbook.mongodb.org/patterns/votes/. It doesn't tell you how to implement aggregation, but you could perhaps do that by making stand-in objects that represent the objects to vote on, but for a specific time period.

    0 讨论(0)
  • 2020-12-24 10:57

    If you are using ruby, there is a votable_mongo plugin for Mongoid & MongoMapper.

    0 讨论(0)
提交回复
热议问题