How to model a unique constraint in GAE ndb

前端 未结 1 1334
暗喜
暗喜 2021-01-26 05:10

I want to have several \"bundles\" (Mjbundle), which essentially are bundles of questions (Mjquestion). The Mjquestion has an integer \"index\" property which needs to be unique

1条回答
  •  后悔当初
    2021-01-26 05:45

    When you use a StructuredProperty, all of the entities that type are stored as part of the containing entity - so when you fetch your bundle, you have already fetched all of the questions. If you stick with this way of storing things, iterating to check in code is the solution.

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