Firestore設計
結構複雑そう
likesを実装する場合のデータ設計パターン
どれが正しいともいえない
migrationする際は、どうする?
とても参考になる
ルール
1つのドキュメントに格納できるのは1MBまで
更新の多さ
modelには、created_atなどの情報を持たせる
読み取るか読み取らないか
書き込みの制限はできる。
コレクショングループのクエリ
Role
roleをデータが持っている
code:json
{
title: "A Great Story",
content: "Once upon a time ...",
roles: {
alice: "owner",
bob: "reader",
david: "writer",
jane: "commenter"
// ...
}
}
ルール設定
Users Collection
Allow users whose authentication id is the same as the id of a document. Tip: This option is only applicable to a 'users' collection.
mute設定はできそう。
muteフィールドを用意する。
設計パターン
データが重複しても良さそう。