Checks if the provided key exists.
Last updated 2 years ago
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
Parameter
Description
key
String
The key that will be checked
Returns
Boolean
Whether or not an element or property exists in the database