.has()
Checks if the provided key exists.
has(key)
Parameter
Description
key
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'); // trueAlso allows the use of dot notation:
db.set('profile', { username: '5antos' }); // { username: '5antos' }
db.has('profile.username'); // true
db.has('profile.password'); // falseLast updated
Was this helpful?