Relationship Commands

Make your data beautiful again.

Relationship Commands

Each fuzzy collection contains an internal collection that stores relationships associated with the collection, the inner collection is also accessible via the command line or the api and it will be named xxxx_RELS where xxxx is your collection name, it will not be listed by the “db listCollectionNames” command, however it does exist and can be used directly. If you do access the relationships collection directly then the system cannot be responsible for any data integrity issues that are created as the relationship collection stores internal ID references to the main collection. Instead of directly accessing the relationships collection, you can use these utility commands on the main fuzzy collection.

findRelationships

usage from API:
usage from CLI: 
  db.aCollection.findRelationships({...filter...}) 

Find relationship follows the same parameters as find on the main collection, however the query will be passed directly to the underlying managed relationship collection.

saveRelationship

usage from API:
  Document saveRelationship(Document relationship)
usage from CLI: 
  db.aCollection.saveRelationship({...relationship...}) 

Adds a new relationship document into the relationship collection, must have the following properties, amongst other user definable items.

{ fromCol: “”, toCol: “”, reltype: “”}

updateRelationship

usage from API:
  Document updateRelationship(Document filter, Document updates, Document options)
usage from CLI: 
  db.aCollection.updateRelationship({...filter...},{...updates...},{...options...}) 

Updates a relationship, when updating a relationship, a history audit change is maintained.

distinctRelationship

usage from API:
  <TResult> Iterable<TResult> distinctRelationship(String string, Class<TResult> resultClass) 
usage from CLI: 
  not supported 

 

Queries the relationships for a distinct value, useful to determine the list of relationship types in use.

Fork me on GitHub