# Data Structure

### Basic Overview

Data records are the basis of what makes TozStore. You can store any data you'd like as part of these record structures and work much like a NoSQL store. However, there are some key differences you should consider when developing your application. Records are stored with a **record type** which is a string value provided at write time which helps you group your data. Record types are essentially a way to represent a collection of certain kinds of records.

### Data

It's important to know what pieces of your data are encrypted when using TozStore. Let's take a look at an example using Social Security Numbers. In the code snippet below we've got an object that holds sensitive information that needs to be encrypted and stored.

```javascript
{ "person" : "Jon Snow", "ssn" : "555-33-2222" }
```

When writing this to TozStore you may call our write function like so:

```javascript
client.write("person", {"name":"Jon Snow","ssn" : "555-33-2222"})
```

In the code example above we've said that the **record type** is "person" and the data is a key value set that includes "name" and "ssn". The field names "name" and "ssn" are not encrypted while the person's name and actual SSN are encrypted.

### Metadata

TozStore also allows you to pass in a third argument we call metadata. This data is also stored unecrypted which allows you to query against it. This makes it easy to find data based on information about the record without needing to expose the sensitive information directly. Let's expand our example.

```javascript
client.write("person", {"name":"Jon Snow","ssn" : "555-33-2222"},{ "house" : "stark"})
```

Now that we've added a key value set of data as metadata we can query for all of our records that are of "house" key equal to "stark". You can include any number of key:value pairs when writing records.


---

# 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://developers.tozny.com/toz-store/core-concepts/data-structure.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.
