Identity constraint is not enough

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Identity constraint is not enough

bserdar
With the way we implemented identity constraint, we mark certain fields as "part of an entity identity", implying the entity can be identified in only one way. There can be many identities on an entity though, for instance for a product, both _id and sku are identities. So, instead of the "identity" constraint, I propose we add something like this to the EntitySchema:

{
  ...
  "identities": [
      [ "_id" ],
      [ "sku" ],
      [ "somefield", "some other field"],
    ...
  ]
  ..
}

The "identities" would be an array, where each element is an array of field names denoting a unique way of identifying an entity.
Reply | Threaded
Open this post in threaded view
|

Re: Identity constraint is not enough

jewzaam
Administrator
I took "identity" constraint as a required set of fields to uniquely identify the record.  There's also the option of creating a unique index.  The problem with many ways to identify a record is audits will be hard to aggregate as identity changes.  Unless a single set of fields can identify a thing this gets complicated.


On Wed, Aug 20, 2014 at 1:20 PM, bserdar [via lightblue-dev] <[hidden email]> wrote:
With the way we implemented identity constraint, we mark certain fields as "part of an entity identity", implying the entity can be identified in only one way. There can be many identities on an entity though, for instance for a product, both _id and sku are identities. So, instead of the "identity" constraint, I propose we add something like this to the EntitySchema:

{
  ...
  "identities": [
      [ "_id" ],
      [ "sku" ],
      [ "somefield", "some other field"],
    ...
  ]
  ..
}

The "identities" would be an array, where each element is an array of field names denoting a unique way of identifying an entity.


If you reply to this email, your message will be added to the discussion below:
http://lightblue-dev.1011138.n3.nabble.com/Identity-constraint-is-not-enough-tp80.html
To start a new topic under lightblue-dev, email [hidden email]
To unsubscribe from lightblue-dev, click here.
NAML