# Data Stores

## Usage

{% hint style="success" %}
Use Data Stores to easily make variables persistent and retrievable.
{% endhint %}

Data Stores are used primarily in [Message Scripts](/unifi/3.0/configuration/message-scripts.md) and [Poll Processor](/unifi/3.0/polling/poll-processors.md) scripts when you want to get and set functional data that is relevent to the integration but does not belong on the target record.

This is particularly handy in a uni-directional integration where polling the remote system is necessary. You can store data such as:

* The last time a request was made
* Identifiers that have been seen before
* Watermarks

## Example

### Storing Strings

Use `getData` and `setData` to work with simple string-like data.

```javascript
// Store the current log count
var log_count = bond.getData('log_count');
bond.setData('log_count', parseInt(log_count, 10) + 1)
```

### Storing Objects

You can also work with objects just as easily by using `getDataObject` and `setDataObject`. These functions automatically take care of encoding the object for database storage and decoding it for JavaScript usage again.

```javascript
// Store the logs that have been seen
var logs_seen = bond.getDataObject('logs_seen'); // [1375, 1399, 1748]
logs_seen.push(2140);
bond.setDataObject('logs_seen', logs_seen);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sharelogic.com/unifi/3.0/administration/data-stores.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
