> For the complete documentation index, see [llms.txt](https://db.coolstone.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://db.coolstone.dev/3/api/manage.md).

# Manage

## Create Record <a href="#create" id="create"></a>

{% tabs %}
{% tab title="In database" %}
{% code lineNumbers="true" %}

```javascript
db.create('tag', content, options)
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>tag</td><td>The new Record's tag</td><td>String</td><td>true</td></tr><tr><td>content</td><td>The Record's content</td><td>Any</td><td>true</td></tr><tr><td>options</td><td>writeFile options</td><td>String || Object</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Standalone" %}
{% code lineNumbers="true" %}

```javascript
const { Record } = require("dubnium")
Record( tag:"tag", dir:"./data", ext:"json", content )
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>dir</td><td>Dir to create in</td><td>String</td><td>true</td></tr><tr><td>tag</td><td>Record's tag</td><td>String</td><td>true</td></tr><tr><td>content</td><td>Record content</td><td>Any</td><td>true</td></tr><tr><td>ext</td><td>File extension</td><td>String</td><td>false</td></tr></tbody></table>

If `ext` is not specified, it will default to `json`
{% endtab %}

{% tab title="From File" %}

```javascript
db.create('tag', path, options)
```

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>tag</td><td>The new Record's tag</td><td>String</td><td>true</td></tr><tr><td>path</td><td>Path to get content from</td><td>String</td><td>true</td></tr><tr><td>options</td><td>writeFile options</td><td>String || object</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Clone" %}

```javascript
db.get('tag').clone('target')
```

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>target</td><td>Target directory to clone the record in.</td><td>String</td><td>true</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Delete Record <a href="#delete" id="delete"></a>

{% tabs %}
{% tab title="1" %}
{% code lineNumbers="true" %}

```javascript
db.get('tag').delete()
```

{% endcode %}
{% endtab %}

{% tab title="2" %}
{% code lineNumbers="true" %}

```javascript
db.delete('tag')
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Close

Delete **all** records & the directory

{% code lineNumbers="true" %}

```javascript
db.close()
```

{% endcode %}

### Wipe

Delete **all** records & *preserve* the directory

{% code lineNumbers="true" %}

```javascript
db.wipe()
```

{% endcode %}

### Delete Old Records

{% code lineNumbers="true" %}

```javascript
db.deleteOld({ ms:5, seconds:5, minutes:5, hours:5, days:0})
```

{% endcode %}

Requires at least one of the options below (multiple options will stack)

<table><thead><tr><th>Name</th><th>About</th><th>Type</th><th data-hidden data-type="checkbox">Required</th></tr></thead><tbody><tr><td>ms</td><td>Milliseconds</td><td>Number</td><td>false</td></tr><tr><td>seconds</td><td>Seconds</td><td>Number</td><td>false</td></tr><tr><td>minutes</td><td>Minutes</td><td>Number</td><td>false</td></tr><tr><td>hour</td><td>Hours</td><td>Number</td><td>false</td></tr><tr><td>days</td><td>Days</td><td>Number</td><td>false</td></tr></tbody></table>

### Delete Large Records

{% code lineNumbers="true" %}

```javascript
db.deleteLarge({ bytes:0, kilobytes:0, megabytes:0, gigabytes:0 })
```

{% endcode %}

Requires at least one of the options below (multiple options will stack)

<table><thead><tr><th>Name</th><th>About</th><th>Type</th><th data-hidden data-type="checkbox">Required</th></tr></thead><tbody><tr><td>options.bytes</td><td>Bytes</td><td>Number</td><td>false</td></tr><tr><td>options.kilobytes</td><td>Kilobytes</td><td>Number</td><td>false</td></tr><tr><td>options.megabytes</td><td>Megabytes</td><td>Number</td><td>false</td></tr><tr><td>options.gigabytes</td><td>Gigabytes</td><td>Number</td><td>false</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/manage.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.
