By reference, you probably mean the key property. This is a link to another data warehouse object. It is present in the db and ndb APIs. Using them, you can simulate a many-to-one relationship by pointing many objects to the key of another object.
A structured property is a completely different beast. It allows you to define a data structure and then include it in another object.
Here is an example from the documents in which you specify several addresses for one contact:
class Address(ndb.Model): type = ndb.StringProperty()
For your specific application, I would recommend using NDB (it is always better to use the latest version of api) with the following:
The publishing model included in the Project model as a repeating structured property. Users include a repeating KeyProperty, which contains the keys of projects for which they have permissions.
To make it a little more complex, you can create another model to represent projects and permissions / roles, and then include this as a repeating structured property in the user model.
The main reason you want to hang on the keys is to make data available in the light of possible HRD consistency.
Let me know if you need more help.
EDIT:
To clarify, a structure is suggested here:
Models:
- User
- User-Project-Mapping (optional, required to handle permissions)
- Project
- Message
The user model should contain User-Project-Mapping as a repeating structured property.
The project model should contain Post as a repeating structured property.
To map user projects, you only need to provide a link to the project and the corresponding representation of permissions.
Since this sounds like a commercial project, if you need more help, I will be happy to advise you. Hope you have enough to succeed!
Sologoub
source share