1.4.5 • Published 2 years ago

@turph/quickmongo v1.4.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

quick.mongo

Simple Database using MongoDB. The name is a copy of quick.db, this uses the Mongo Atlas Database to store data though

Documentation

new Database()

new database(mongo url, options)
ParameterTypeOptionalDescription
Mongo URLURLThe URL given to you by the MongoDB Atlas Connection
optionsObjectnullnull
options.nameStringThe name of the collection you want to create

Example

  const quickMongo = require('@turph/quickmongo');
  
  const database = new quickMongo('{ INSERT MONGO URL HERE }', { name: 'database' });
  db
  .on('error', err => console.log(err))
  .on('connected', info => console.log(info));

Constructor

database.set()

database.set(key, value)
ParameterTypeOptionalDescription
KeyStringThe key of the value
ValueString / ObjectThe value of the key you wish to set

Example

await database.set('foo', 'fee');

Returns Promise[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

database.get()

await database.get(key)
ParameterTypeOptionalDescription
keyStringThe key of that vakue you wish to find

Example

await database.get('foo'); // fee

Returns Promise[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)

database.search()

database.search(query)
ParameterTypeOptionalDescription
queryStringThe term you wish to search for

Example

await database.search('foo');

Returns Promise[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

database.find()

database.find(query)
ParameterTypeOptionalDescription
queryStringThe term you wish to search for

Example

await database.find('foo');

Returns Promise[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

database.all()

database.all()
ParameterTypeOptionalDescription

Example

await database.all()

Returns Promise[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)

database.delete()

database.delete(key)
ParameterTypeOptionalDescription
KeyStringThe key of the value you wish to delete

Example

await database.delete('foo');

Returns Promise[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

database.clear()

database.clear(key)
ParameterTypeOptionalDescription
KeyStringThe key of the value you wish to clear from your database. Note: this will delete ALL matches so perform at your own risk

Example

await database.clear('foo');

Returns Promise[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

database.push()

database.push(key, values)
ParameterTypeOptionalDescription
KeyString✖️The key you want to push values into
ValuesArray✖️The values you want to push into

Example

await database.push('foo', ['fee', 'foo'])

Returns Promise[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

Extra Information

This will not be updated frequently and will most likely only be updated for bug fixes. Extra features will not be added.

Contributors

Tur-ph

1.4.5

2 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago