---
description: >-
  The init function/method sets up a table using a key name and a value. Here,
  we will go through both a simple example on basic node projects and a
  discord.js example.
---

# Init

#### Example:&#x20;

{% tabs %}
{% tab title="Basic Usage" %}
```javascript
const db = require('hive-db');

db.init('bio',{age:'21', name:'Lason'});
db.get('bio');
// output => {age:'21', name:'Lason'}

db.get('bio.age');
// output => 21

db.get('bio.name');
// output => Lason
```
{% endtab %}

{% tab title="Discord Bot" %}
```javascript
const Discord = require('discord.js');
const db = require('hive-db');
 
 run = async (message, args, client) =>{
 message.channel.send('Enter your name');
 db.init('name', args[0]);
 }

//Trigger function using get, next page in the documentation!

const Discord = require('discord.js');
const db = require('hive-db');
 
 run = async (message, args, client) =>{
 message.channel.send('Your name is \t'+db.get('name'));
 }
 /*
 You can do only user based values that are unique for example, to remember
 the name of some users db.init(`name_${message.author.id}`, args[0]), because 
 discord user ids are unique, same goes with guild values!
 */
```
{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you have any more queries related to this make sure to ask out on our [support server.](https://discord.gg/RTh79cwxxp)
{% endhint %}
