Object Store

Discover more about the Object Store component and how to use it on the Digibee Integration Platform.

Object Store makes operations to store any document in the Object Store of Digibee. It's a simple and quick way to save useful JSON-type information, which has operations to help in multiple uses during the creation of a pipeline.

Parameters

Take a look at the configuration parameters of the component. Parameters supported by Double Braces expressions are marked with (DB).

Best practices

Object Store is an auxiliary database (NoSQL) for integrations. Its use provides more agility and practicality in the development of integrations. To exemplify the applicability of this component, we list the following good usage practices:

  • The Object Store component has the function of an intermediary database, i.e., it is used to mediate information between the flows of an integration. It must therefore only be used to store information that is relevant to the integration in question.

  • The Object Store is a temporary database. Once it is used to intermediate relevant information to the integration flow, old and dispensable data must be periodically removed from the database.

  • Since it is an auxiliary base, the Object Store component must not be used as a permanent database and only in certain cases, with the purpose of supporting the user in the development of integrations.

  • All data is stored with maximum security within the Digibee Integration Platform. However, we recommend that sensitive data stored in the Object Store be encrypted. To do this, use our encryption connectors available in Canvas.

Messages flow

Input

For this specific component, the only mandatory input message pattern is the JSON format applied to the object. The input parameter can use the Double Braces syntax to send the received message to the component.

Output

  • Insert

{
    "data": [],
    "updateCount": 1
}
  • Find

{
   "data": [
       {
           "name": "Galaxy s20",
           "uuid": "123",
           "_oId": "1"
       }
   ],
   "rowCount": 1
}
  • Update

{
    "data": [],
    "updateCount": 1
}
  • Delete

{
    "data": [],
    "updateCount": 1
}
  • Aggregate

{
    "data": [],
    "rowCount": 0
}

Object Store in Action

Some output examples of each operation were shown above. See below more applications that demonstrate the correct configuration for a determined result to be obtained:

Insert multiple items at once in a collection

When sending an object array in the query field, the component inserts each item in a separate way inside the selected collection.

Observe how to configure the component with the Operation (Insert), Unique Index (False) and Query parameters:

[
   {
       "id": 1,
       "name": "Galaxy s20",
       "price": 5000
   },
   {
       "id": 2,
       "name": "Samsung 4k 55\"",
       "price": 5000
   },
   {
       "id": 3,
       "name": "Galaxy A10",
       "price": 699
   },
   {
       "id": 4,
       "name": "Galaxy A51",
       "price": 1620
   }
]

Output

{
    "data": [],
    "updateCount": 4
}

Important: the insertion of multiple objects at once is allowed in collections created with Unique Index (False) only. The Unique Index property is defined in the collection creation. After the index is created, it's not possible to change the property.

Find items from a determined query

As an example, consider an Object Store that already has registered product-type items and whose characteristics are name and price.

Observe how to configure the component with the Operation (Find By Query) and Query parameters:

{
    "product.price": { $gt: 2000 }
}

Output

{
   "data": [
       {
           "product": {
               "id": 1,
               "name": "Galaxy s20",
               "price": 5000
           },
           "_oId": "1"
       },
       {
           "product": {
               "id": 2,
               "name": "Samsung 4k 55\"",
               "price": 5000
           },
           "_oId": "2"
       }
   ],
   "rowCount": 2
}

Find all the items from a query

As an example, consider an Object Store that already has registered product-type items and whose characteristics are name and price.

Observe how to configure the component with the Operation (Find By Query), Limit (10) and Query parameters:

{}

Output

{
   "data": [
       {
           "product": {
               "id": 1,
               "name": "Galaxy s20",
               "price": 5000
           },
           "_oId": "1"
       },
       {
           "product": {
               "id": 2,
               "name": "Samsung 4k 55\"",
               "price": 5000
           },
           "_oId": "2"
       },
       {
           "product": {
               "id": 3,
               "name": "Galaxy A10",
               "price": 699
           },
           "_oId": "3"
       },
       {
           "product": {
               "id": 4,
               "name": "Galaxy A51",
               "price": 1620
           },
           "_oId": "4"
       }
   ],
   "rowCount": 4
}

In this specific scenario, the Limit parameter was configured so there wouldn't be an unnecessary overload when returning the objects from an Object Store. If the option isn't configured that way, an "Out Of Memory" error can occur inside the pipeline. In the indicated way, there's control over how many objects are seen in the response.

Update an item from a specific ID

As an example, consider an Object Store that already has registered product-type items and whose characteristics are name and price.

Observe how to configure the component with the Operation (Update By Object ID), Object ID (3) and Document parameters:

{
   $set: {
       "product": {
         "id": 3,
         "name": "Galaxy A10",
         "price": 605
       }
   }
}

Output

{
    "data": [],
    "updateCount": 1
}

In this specific scenario, it's possible to see that the output is only an object identifying an update. To check if the object has been properly updated, repeat the ID search scenario.

Important: if the Object Store component is involved in updates, inside an iteration component (For Each, Stream File Reader, etc.) and making parallel executions, there can be concurrence in the registers update if the update instructions are exactly the same. Consequently, one instruction will return "updateCount":1 and the other "updateCount": 0. It happens when 2 registers that are exactly the same get into the Object Store operation pool and the update or insertion instructions (with the Upsert parameter enabled) are sequentially executed. The first instruction makes an update and the second one finds the already-persisted register and checks there's nothing to be changed, returning there was no need for an action ("updateCount": 0).

Remove an item from a specific ID

As an example, consider an Object Store that already has registered product-type items and whose characteristics are name and price.

Observe chow to configure the component with the Operation (Delete By Object Id) and Object ID (4) parameters:

Output

{
    "data": [],
    "updateCount": 1
}

In this specific scenario, it's possible to see that the output is only an object that identifies the update. To check if the object has been properly updated, repeat the ID search scenario.

Aggregation to copy the collection

As an example, consider an Object Store called "product" that already has registered product-type items and whose characteristics are name and price. From that, create a new Object Store called "product-backup", copying all the items of the collection mentioned above.

You must receive an object array containing the query aggregation pipelines in the Document parameter.

Observe how to configure the component with the Operation (Aggregate) and Query parameters:

[
   {
       $merge: {
           into: "product-backup",
           on: "_id",
           whenMatched: "replace",
           whenNotMatched: "insert"
       }
   }
]

In this specific scenario, the query was configured to replace the repeated items with the new ones in the collection.

Output

{
    "data": [],
    "rowCount": 0
}

To check if the collection has been properly created with the proposed items, repeat the search scenario with all the items and inform the new collection.

Aggregation to filter collection items

You must receive an object array containing the query aggregation pipelines in the Document parameter.

Observe how to configure the component with the Operation (Aggregate) and Query parameters:

[
   {
       $match: {
           "product.price": {
               $gt: 3000
           }
       }
   },
   {
       $group: {
           _id: null,
           count: {
               $sum: 1
           }
       }
   }
]

In this specific scenario, the query was configured to search products that has a determined value and to show their sum.

Output

{
    "data": [{
        "count": 2
    }],
    "rowCount": 0
}

Technology

Object Store uses search operators and objects aggregation similar to the MongoDB syntax. Refer to the MongoDB external documentation to learn more.

Last updated