.has()

Checks if the provided key exists.

has(key)

Parameter

Description

key

String

The key that will be checked

Returns

Description

Whether or not an element or property exists in the database

db.set('prefix', '!'); // '!'

db.has('prefix'); // true

Also allows the use of dot notation:

db.set('profile', { username: '5antos' }); // { username: '5antos' }

db.has('profile.username'); // true
db.has('profile.password'); // false

Last updated