# Templates

## Make a new Template <a href="#new" id="new"></a>

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

```javascript
const { Dubnium, Template } = require('dubnium') // require('dubnium') is an alias of require('dubnium').Dubnium
const template = new Template({
id:"",
name:"",
password:""
})
```

{% endcode %}
{% endtab %}

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

```javascript
import { Dubnium, Template } from 'dubnium'
const template = new Dubnium.Template({
id:"",
name:"",
password:""
})
```

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

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>template</td><td>The object to base the new Template on.</td><td>Object</td><td>true</td></tr></tbody></table>

## Use Template <a href="#use" id="use"></a>

{% code lineNumbers="true" %}

```javascript
database.create('tag', template.use('123456',"John","password"))
```

{% endcode %}

The parameters of this function are what will be set to the value of the keys in order.

**Example**: the parameter`John` will be the value of `name`since they are both in the second position.

## Full code example <a href="#example" id="example"></a>

{% code lineNumbers="true" %}

```javascript
const { Dubnium, Template } = require('dubnium')
// import { Dubnium, Template } from 'dubnium' // for ESM
const database = new Dubnium('./db','json' /* Templates are JSON only */) // Initialize a database

const template = new Template({ // Make a new Template
id:"",
name:"",
password:""
})

database.create('tag', template.use('123456',"John","password")) // Create a Record based on the Template
```

{% 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/2/templates.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.
