# Search

## Search Tags

{% code lineNumbers="true" %}

```javascript
db.list({filter:() => e.tag == "TAG", limit:10})
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>options.filter</td><td>Filter function</td><td>Function</td><td>false</td></tr><tr><td>options.limit</td><td>Max results</td><td>Number</td><td>false</td></tr></tbody></table>

## Search all Records by Content

{% code lineNumbers="true" %}

```javascript
db.getFromValue('query', limit)
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>query</td><td>Query to search for</td><td>String</td><td>true</td></tr><tr><td>limit</td><td>Max results</td><td>Number</td><td>false</td></tr></tbody></table>

## Search Content

{% tabs %}
{% tab title="Search" %}
Convert content to String and return the result of [`String.search()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search)

{% code lineNumbers="true" %}

```javascript
db.get("tag").search('query')
```

{% endcode %}
{% endtab %}

{% tab title="Search As Array" %}
{% hint style="danger" %}
This function is deprecated
{% endhint %}

Have Dubnium split the content by a character and then search the array.

{% code lineNumbers="true" %}

```javascript
db.get('tag').searchAsArray('query', 'splitBy')
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td><p></p><p>splitBy</p></td><td>String to split the Record's content by. For example, \n for lines or " " for spaces. If not present, Dubnium will default to space.</td><td>String</td><td>false</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

### Search Object Keys <a href="#search-keys" id="search-keys"></a>

{% hint style="danger" %}

### JSON Only <a href="#search-keys" id="search-keys"></a>

This function searches object keys only.
{% endhint %}

{% code lineNumbers="true" %}

```javascript
db.get('tag').searchKeys('query')
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>query</td><td>The search query</td><td>String</td><td>true</td></tr></tbody></table>


---

# 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://db.coolstone.dev/3/api/search.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.
