# Miscellaneous

## Directory

### Change <a href="#change-dir" id="change-dir"></a>

{% code lineNumbers="true" %}

```javascript
db.config.dir = './new/dir'
```

{% endcode %}

### Make <a href="#make-dir" id="make-dir"></a>

{% code lineNumbers="true" %}

```javascript
await db.dir()
```

{% endcode %}

## Read Configuration <a href="#get-dir" id="get-dir"></a>

{% code lineNumbers="true" %}

```
db.config[setting]
```

{% endcode %}

## Search Content

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
await db.get("tag").search('query')
```

{% endcode %}

## Create Symlink to a Record <a href="#create-symlink" id="create-symlink"></a>

{% code lineNumbers="true" %}

```javascript
await db.get('tag').symlink('./path/to/symlink') 
```

{% endcode %}

<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>Path to a directory where the symlink will be created</td><td>String</td><td>true</td></tr></tbody></table>

## Get Record's Stats <a href="#get-stats" id="get-stats"></a>

{% code lineNumbers="true" %}

```javascript
await db.get('tag').stats()
```

{% endcode %}

## End

If you want to *end* a string of methods, you can with `.end()`. **Note: this is not required.**

{% code lineNumbers="true" %}

```javascript
db.get("tag").write(content).end()
```

{% endcode %}

## Exit <a href="#exit" id="exit"></a>

If you wish to exit the Record editor API, call the `exit()` method and it will return the class.

{% code lineNumbers="true" %}

```javascript
db.get('tag').write(content).exit().//any_class_function
```

{% endcode %}

## Internal Functions

Dubnium exports some internal functions that can be used in your project.

{% code lineNumbers="true" %}

```javascript
require('dubnium/functions')
```

{% endcode %}

## Aliases

Don't like the name we chose for a method? Set an alias!&#x20;

{% code lineNumbers="true" %}

```javascript
db.alias('alais_here', 'existing_function')
```

{% endcode %}

For example,

{% code overflow="wrap" lineNumbers="true" %}

```javascript
db.alias('val', 'getFromValue') // Allows you to call db.val() instead of db.getFromValue()
```

{% endcode %}

## Iterate

{% code lineNumbers="true" %}

```javascript
for(record of db) {
console.log(record)
}
```

{% endcode %}

## Lock/Unlock

Uses [proper-lockfile](https://www.npmjs.com/package/proper-lockfile).

{% code lineNumbers="true" %}

```javascript
db.get('tag').lock() // Locks the file
```

{% endcode %}

{% code lineNumbers="true" %}

```javascript
db.get('tag').umlock() // Unlocks the file
```

{% endcode %}

## Get Database Name <a href="#all" id="all"></a>

{% hint style="info" %}
Names are derived from the directory's base name or can manually be set in config object when initializing.
{% endhint %}

{% code lineNumbers="true" %}

```javascript
db.name
```

{% endcode %}


---

# 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/4/advanced/miscellaneous.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.
