Collection

Add Collection

The Collections section on the model view page lists all collections of the model. As you can see, the RBAC model still does not have any collection. Click the Add Collection tab to add a collection.

_images/ViewModel-ac.png

You will enter the name, and the description of the collection optionally and then click the Add Collection button to create the collection.

Let us start with the User collection:

_images/CreateUserColl.png

After entering the collection’s name and description, click the Add Collection button to create the collection. The model viewer page will be re-loaded when the collection is created.

_images/UserCollCreated.png

Now, when you created the collection, the next step is to view the collection (load the collection view page) in order to continue with the creation of collection’s elements (Documents and Fields).

View Collection

When you click a collection’s link on the model page,

_images/ViewModel-ClickCollection.png

the collection view page will be loaded:

_images/ViewCollection.png

Besides the Collection tab, this page has the Add Document tab that is used to add a document to the collection.

There are few buttons you can use:

  • Models (go back to M2 home page that lists all models you have access to)
  • Full Model View (the full model view page that shows all elements of the model)
  • Update (update collection)
  • Copy (copy collection)
  • Delete (delete collection)

The bottom part of the collection page belongs to the documents of the collection. Usually the structure of a collection is uniform in which case only one document (defining all fields) is associated with the collection.

The default document of the collection is automatically created when the collection is created. The default document has the same name as the collection and it does not contain any field initially. That is why you see the User document associated with the User collection.

The structure of a collection can change over time in which case you may either keep changing the original document or end up with more than one document per collection. This is the reason why documents have active property, as you can see above. This property indicates if the document is still actively involved in defining the collection format in which case its value is yes or it is kept here just for historical and documentation purposes so that you and users of the model see the history of changes on the collection structure, in which case its value will be no.

For example, with the first version of the model you had one document associated with the User collection. You created or generated code based on this model and started managing data with your application. However, down the road, you changed the structure of the collection by adding another document for it. At this point you can end up with two sets of functions/methods (in whatever language you are developing your application) to manage data in the User collection. You will have one document in the model for each of them and both of them will have active flag set to yes.

You can create additional collection’s documents via this page. They will be listed on this page as soon as they are created.

Update Collection

Click the Update button on the collection page to update the collection

_images/ViewCollection-Update.png

and the update collection page will be loaded:

_images/UpdateCollection.png

You can update the name or description of the collection and click the Update button to submit the updates. Otherwise click the Cancel button if you have changed your mind and do not want to update the collection.

Copy Collection

Click the Copy button on the collection page to make a copy of a collection in its related model:

_images/ViewCollection-Copy.png

This is how the copy collection page looks like when it is loaded:

_images/CopyCollection.png

Enter the name of the new collection that will be a copy of the original collection and click the Copy button to copy the collection. Otherwise click the Cancel button to go back to the collection page.

The whole collection is copied together with all of its documents and their fields.

Delete Collection

Click the Delete button on the collection page to remove the collection:

_images/ViewCollection-Delete.png

A small confirmation window will pop up. You can either confirm collection removal or cancel it.

When the collection is removed, all documents associated with it are also removed.