Collection Definition Records

A CDR (Collection Definition Record) defines a specific collection in the Dgraph.

A collection is represented in the Dgraph by a Collection Definition Record (CDR). A CDR is created when the putCollection and the putCollections operations are successful. Although CDRs are not user-visible, the listCollections operation in effect returns a representation of the CDR via the collectionRecord element.

When the CDR is first created, it looks like this example when shown via the listCollections operation:
<collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
     <description>product records for the region</description>
     <property key="Region">New England</property>
     <collectionAttributes/>
</collectionRecord>

Note that the collectionAttributes field is empty, which means that no records are associated with this collection at this time.

After source records are ingested into the data domain, the attributes that are tagged on to collection-related records (i.e., records that have a uniquePropertyKey assignment) are added to the CDR with collectionAttribute attributes, as in this example from a listCollections operation:
<collectionRecord collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
   <description>product records for the region</description>
   <property key="Region">New England</property>
   <collectionAttributes>
      <collectionAttribute propertyKey="Class"/>
      <collectionAttribute propertyKey="Color"/>
      <collectionAttribute propertyKey="DaysToManufacture"/>
      <collectionAttribute propertyKey="DealerPrice"/>
      <collectionAttribute propertyKey="FinishedGoodsFlag"/>
      <collectionAttribute propertyKey="ListPrice"/>
      <collectionAttribute propertyKey="ModelName"/>
      <collectionAttribute propertyKey="ProductID"/>
      <collectionAttribute propertyKey="ProductLine"/>
      <collectionAttribute propertyKey="ProductSubcategoryKey"/>
      <collectionAttribute propertyKey="ReorderPoint"/>
      <collectionAttribute propertyKey="SafetyStockLevel"/>
      <collectionAttribute propertyKey="Size"/>
      <collectionAttribute propertyKey="SizeRange"/>
      <collectionAttribute propertyKey="SizeUnitMeasureCode"/>
      <collectionAttribute propertyKey="StandardCost"/>
      <collectionAttribute propertyKey="Status"/>
      <collectionAttribute propertyKey="Style"/>
      <collectionAttribute propertyKey="Weight"/>
   </collectionAttributes>
</collectionRecord>

Now the collectionAttributes field has been populated with the record attributes that comprise this collection.

collectionRecord properties

The collectionRecord element has the properties listed in this table. The properties (with the exception of the collectionAttribute properties) are initially set by the user via the collection attributes of a putCollection or putCollections operation:
collectionRecord Property Description
collectionKey The name of the collection, used to specify this collection in all Endeca Server APIs (including queries). Set via the collection::collectionKey attribute.
displayName An arbitrary string value that can be used by applications, intended for use as a user-friendly display name of the collection. Set via the collection::displayName attribute.
uniquePropertyKey The standard attribute that determines which records will be part of this collection. Set via the collection::uniquePropertyKey attribute.
description An arbitrary string value that can be used by applications, intended for use as a description of the collection. Set via the collection::description attribute.
property key String metadata that is associated with the collection. Set via the collection::property key attribute.
collectionAttribute propertyKey A standard attribute that belongs to the collection. These properties are added by the Dgraph during a record ingest operation and cannot be modified by the user.