I need an advice about NoSQL/MongoDb and data/models structure

前端 未结 5 1002
醉梦人生
醉梦人生 2021-02-05 14:30

Recently I\'m exploring NoSQL Databases. I need an advice about how to store data in the most optimal and efficient way for a given problem. I\'m targeting MongoDB, now. However

5条回答
  •  抹茶落季
    2021-02-05 15:13

    Ok, you haven given a normalized data model as you would do in an SQL setup.

    In my understanding you don't do this in MongoDB. You could store references, but you do not for performance reasons in the general case.

    I'm not an expert in the NoSQL area in no way, but why don't you simply follow your needs and store the user (ids) that have voted for a story in the stories collection and the story (ids) a user has voted for in the users collection?

提交回复
热议问题