Giter Site home page Giter Site logo

relnet's People

Contributors

yyokii avatar

Stargazers

 avatar  avatar

Watchers

 avatar

relnet's Issues

Firestore 設計

  • users(任意のauth IDをdocument IDとする)
    • name
      • (サブコレクション)persons
        • firstName
        • lastName
        • groupIDs
        • ...
        • createdAt
        • updatedAt
      • (サブコレクション)groups
        • name
        • description
        • ...
        • createdAt
        • updatedAt

personとgroupはn:nの関係である。
それをどう表現するかであるが、personにおいてgroupIDを配列で保持する。

Pros

  • 単純: 設計が単純で理解しやすい。
  • 効率的な読み取り: 単一のドキュメント読み取りでエンティティとその関連エンティティのIDを取得できます。

Cons

  • 読み取り時のオーバーヘッド: IDから関連するエンティティの詳細を取得するには、追加の読み取りが必要です。 → その通りであるが、ジャンクションコレクションのような手法をしても何かしらの追加読み取りは必要
  • 更新の効率: 一つのグループを削除するときに、多くの人々のドキュメントを更新する必要があります。 → 個人のコレクション内での操作なので比較的コストは低い
  • 配列のサイズ制限: Firestoreの単一ドキュメントには1MBのサイズ制限があります。 → これを超えるデータ量になることが想定し難い。groupを10万個ほど登録すれば1MBを超える可能性があるが、機能的にそうするモチベーションは薄く、操作の難易度も高い。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.