A simple database using mongodb atlas
npm install @turph/quickmongo> Simple Database using MongoDB.
> The name is a copy of quick.db, this uses the Mongo Atlas Database to store data though
``js`
new database(mongo url, options)
Parameter | Type | Optional | Description
--- | --- | --- | ---
Mongo URL | URL | ✖ | The URL given to you by the MongoDB Atlas Connection
options | Object | null | null
options.name | String | ✖ | The name of the collection you want to create
#### Example
`js`
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
`js`
database.set(key, value)
Parameter | Type | Optional | Description
--- | --- | --- | ---
Key | String | ✖ | The key of the value
Value | String / Object | ✖ | The value of the key you wish to set
#### Example
`js`
await database.set('foo', 'fee');
`js`
await database.get(key)
Parameter | Type | Optional | Description
--- | --- | --- | ---
key | String | ✖ | The key of that vakue you wish to find
#### Example
`js`
await database.get('foo'); // fee
`js`
database.search(query)
Parameter | Type | Optional | Description
--- | --- | --- | ---
query | String | ✖ | The term you wish to search for
#### Example
`js`
await database.search('foo');
`js`
database.find(query)
Parameter | Type | Optional | Description
--- | --- | --- | ---
query | String | ✖ | The term you wish to search for
#### Example
`js`
await database.find('foo');
`js`
database.all()
Parameter | Type | Optional | Description
--- | --- | --- | ---
| | | |
#### Example
`js`
await database.all()
`js`
database.delete(key)
Parameter | Type | Optional | Description
--- | --- | --- | ---
Key | String | ✖ | The key of the value you wish to delete
#### Example
`js`
await database.delete('foo');
`js`
database.clear(key)
Parameter | Type | Optional | Description
--- | --- | --- | ---
Key | String | ✖ | The key of the value you wish to clear from your database. Note: this will delete ALL matches so perform at your own risk
#### Example
`js`
await database.clear('foo');
`js`
database.push(key, values)
Parameter | Type | Optional | Description
--- | --- | --- | ---
Key | String | ✖️ | The key you want to push values into
Values | Array | ✖️ | The values you want to push into
#### Example
`js``
await database.push('foo', ['fee', 'foo'])
This will not be updated frequently and will most likely only be updated for bug fixes. Extra features will not be added.