Skip to content

Collection

daschy edited this page Jan 4, 2017 · 1 revision

The Collection keyword creates a new Collection object. The way information shall be displayed in a visualization page will be derived from it. Its identity fields are:

  • label (optional): this attribute accepts a string. It contains the string that is going to be displayed as a title to the query result;

  • table (required): this attribute accepts a string. It contains the name of the MongoDB database Collection to which the query is going to make reference;

  • sortby (optional): this attribute accepts a string. It contains the name of the MongoDB database column that the query will use as a reference to sort the result;

  • order (optional): this attribute accepts a string with value "asc" o "desc". It's the type of order for the sortby parameter:

  • "asc" means that the order will be ascending (this is also the default value);

  • "desc" means that the order will be descending.

  • query (optional): this attribute accepts a JSON object. It contains the parameters and the values on which to execute the query.

Its body fields are:

  • column (optional): It corresponds to the information of a column in the Collection. It's composed by the fields described below

    • name (required): it's the name of the MongoDB collection's column;
    • label (optional): it's an alternative name for the column's column;
    • type (required): It contains the type of the data contained in the column. Possible types are:
      • Array: an array of elements;

      • Object: a JSON object;

      • Link: a link to a specific resource

        link(
            label: <text to show>
        )
        
      • Image: an image file

        image(
            height: <pixels>
            width: <pixels>
        )
        
      • String: a simple string;

      • Number: a simple number.

  • action (optional): It contains the actions that can be invoked from the Collection. It's composed by the fields described below

    • Export (optional): it's the action that exports the data structure of the Collection. Possible values are json, csv, true, false;
    • SendEmail (optional): it's the action that sends an email containing the data structure of the Collection. Possible values are json, csv, true, false.

The following code shows an example of Collection:

Collection(
    table: "customers",
    label: "JuniorCustomers",
    ---------id: "Junior",
    ---------Weight:"0",
    perpage: "20",
    sortby: "surname",
    order: "asc",
    query: {age: {$lt: 40}}
) {
    column(
        name: "3"
    )
    action(
        Export: "true",
        SendEmail: "true"
    )
    column(
        name: "4"
    )
    Document(
        table: "prova"
    ){
        row(
            name: "asd"
        )
        action(
            SendEmail: "true"
        )
    }   
    column(
        name: "5"
    )
}
Clone this wiki locally