Best way to model a voting system in MongoDB

后端 未结 2 416
一整个雨季
一整个雨季 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.

提交回复
热议问题