Simple storage

The Simple storage component allows Connect to store and retrieve key:value pairs from a MongoDB database.

Purpose

The main goal of this component is to provide simple storage and retrieval of key:value pairs.

Requirements

The connector requires a working instance of MongoDB.

Credentials

Credentials
hostname

Hostname or IP address of MongoDB server.

port

The port used by your MongoDB server to accept connections. (Default is 27017)

db

Database name used to store collections with key:values.

user

MongoDB username with access to read and write from/to corresponding DB and collection.

pass

The password for a specified user.

Triggers

This component has no trigger functions. This means it will not be accessible to select as a first component during the integration flow design.

Actions

Store key

Inserts new or updates an existing key:value pair.

Store Key

Input fields

keyName

The name of a field where the key will be stored.

key

The value of a key that uniquely identifies the key:value pair.

valueName

Name of a field where value will be stored.

value

The value that will be stored and can be accessed with provided keyName and key.

If the Update if exists? checkbox is selected, then the value would be updated if it already exists.

The resulting document is stored in MongoDb with the following structure:

Table 1. Results
Scenario Source Result

There is no such existing keyName:key:

{
  "response": "inserted"
}

The entry is inserted.

Another valueName is stored with the same keyName:key.

{
    keyName: key,
    valueName: value,
    valueName1: value1
}

The new value is added to the document.

The keyName:key already exists but does not have valueName provided.

{
  "response": "updated"
}

The valueName is added to the existing keyName:key.

The keyName:key and valueName combination already exists, and the Update if exists? checkbox is selected.

{
  "response": "updated"
}

The value is updated.

The keyName:key and valueName combination already exists, and the Update if exists? checkbox is not selected.

{
  "response": "skipped"
}

No action is taken.

Store key batch

This action will insert a new or replace an existing key:value pair from Batch.

Store Key Batch

Input fields:

keyName

Name of a field where the key will be stored.

valueName

Name of a field where value will be stored.

keyValArray

Array with values.

Each value in the array is an object which has the following fields:

keyValue

The value of a key that uniquely identifies the key:value pair.

value

The value that will be stored and can be accessed with provided keyName.

Request example:

{
    keyName: "someKeyName",
    valueName: "someValueName",
    keyValArray: [
        {
            keyValue : "someKeyValue1",
            value: "someValue1"
        },
        {
            keyValue : "someKeyValue2",
            value: "someValue2"
        }
    ]
}

All provided key:value pairs will be inserted. If a key already exists, it will be replaced.

Response:

{
  "response": "done"
}

Retrieve Key

Returns value by providing key and value name if found or default value.

Retrieve Key

Input fields:

keyName

Name of a field where the key is stored.

key

Value of a key that uniquely identifies key:value pair.

In response document from MongoDB collection will be provided, for example:

{
    keyName: keyValue,
    valueName: value,
    valueName1: value1
}

Retrieve Key Batch

Returns an array of values provided by the key array.

Retrieve Key Batch

Input fields:

keyName

The name of a field where the key is stored.

keyArray

An array of keyValues.

The response format is following:

{
  "response": [
    {
      keyName1: key1,
      valueName1: value1
    },
    {
        keyName2: key2,
        valueName2: value2
    }
  ]
}

Remove Key

Removes the value provided in valueName, or all values for a specified key if Delete all values for this key? checkbox is selected.

Remove Key

Input fields:

keyName

Name of a field where the key is stored.

key

The value of a key that uniquely identifies the key:value pair.

valueName

Name of a field that should be deleted

Response format is following:

{
  "result": "done"
}