{"id":15154427,"url":"https://github.com/davipatricio/easy-mongodb","last_synced_at":"2025-09-30T02:30:25.108Z","repository":{"id":103704662,"uuid":"388278741","full_name":"davipatricio/easy-mongodb","owner":"davipatricio","description":"MongoDB wrapper for begginers using Mongoose and simple syntax made with JavaScript.","archived":true,"fork":false,"pushed_at":"2021-07-22T15:05:11.000Z","size":34,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T19:39:20.505Z","etag":null,"topics":["database","easy-mongodb","javascript","js","mongo","mongo-db","mongodb","mongoose","node","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davipatricio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-22T00:10:12.000Z","updated_at":"2023-07-02T02:37:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a2f0387-6b2f-460c-9250-cf41e8e73854","html_url":"https://github.com/davipatricio/easy-mongodb","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"22ac2b079f0139bc6fad7cc26ab058b96e8585b9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davipatricio/easy-mongodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davipatricio%2Feasy-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davipatricio%2Feasy-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davipatricio%2Feasy-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davipatricio%2Feasy-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davipatricio","download_url":"https://codeload.github.com/davipatricio/easy-mongodb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davipatricio%2Feasy-mongodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277618558,"owners_count":25848554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","easy-mongodb","javascript","js","mongo","mongo-db","mongodb","mongoose","node","nodejs"],"created_at":"2024-09-26T17:23:27.527Z","updated_at":"2025-09-30T02:30:25.103Z","avatar_url":"https://github.com/davipatricio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-mongodb\nMongoDB wrapper for beginners using Mongoose and simple syntax made with JavaScript.\n\n---\n\nA simple promise-based wrapper made for beginners with focus in Performance and Simplicity.\n\nInspired in [quick.db](https://www.npmjs.com/package/quick.db), [Enmap](https://www.npmjs.com/package/enmap) and [denky-database](https://www.npmjs.com/package/denky-database)\n\n---\n\n## Installation\n`npm install easy-mongodb.js --production`\n\n`yarn add easy-mongodb.js`\n\n## Support\nCreate a issue or join my Discord server [click here](https://discord.gg/bVWdscg) (support only in english and portuguese)\n\n---\n\n## Example\n```js\nconst DatabaseManager = require('easy-mongodb.js');\nconst db = new DatabaseManager('mongodb url here', 'name');\n\ndb.on('ready', async () =\u003e {\n\tconsole.log('Database connected successfully.');\n  \n\t// Create key 'companies' with an array as value.\n\tawait db.set('companies', ['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google'];\n  \n\t// Get the companies list from database\n\tconst companiesList = await db.get('companies');\n\tconsole.log(companiesList); // Should return an array.\n});\n\ndb.on('error', (mongooseError) =\u003e {\n\tconsole.log('Unexpected error:', mongooseError);\n});\n\ndb.on('disconnect', (mongooseError) =\u003e {\n\tconsole.log('Disconnected from the database. Trying to reconnect automatically...');\n});\n\ndb.connect();\n```\n\n---\n\n## Documentation\n- `Database#connection` **|** Mongoose connection object\n- `Database#db` **|** Mongoose connection object\n- `Database#model` **|** Mongoose model object\n- `Database#mongoose` **|** Mongoose model object\n- `Database#schema` **|** Mongoose schema object\n\n\n\n- `Database#connect()` **|** Connects to the MongoDB database\n- `Database#disconnect()` **|** Disconnects from the MongoDB database (and don't reconnect automatically)\n\n- `Database#set(key, value)` **|** Create or changes a key with the specified value\n  ```js\n  Database.set('website', 'www.github.com/DenkyLabs');\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Value: any (\\*)\n\n- `Database#get(key)` **|** Returns the value of the specified key\n  ```js\n  Database.get('website');\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Returns: undefined or any (\\*)\n\n- `Database#delete(key)` **|** Delete a key from the database\n  ```js\n  Database.delete('website');\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Returns: Object or null\n\n- `Database#exists(key)` **|** Check if a key exists\n  ```js\n  Database.exists('website');\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Returns: boolean\n\n- `Database#inc(key)` **|** Increment a number to the key (addition)\n  ```js\n  await Database.set('number', 15);\n  Database.inc('number', 30) // Sets the value to 45\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Returns: Object or number\n\n- `Database#dec(key)` **|** Decrease a number to the key (addition)\n  ```js\n  await Database.set('number', 15);\n  Database.dec('number', 10) // Sets the value to 5\n  ```\n  - Types:\n    - Key name: any (\\*)\n    - Returns: Object or number\n\n- `Database#deleteAll()` **|** Deletes everything from the database\n```js\nDatabase.deleteAll()\n```\n  - Types:\n    - Returns: Array\u003cDeleted object names or empty\u003e\n\t\n- `Database#keyArray()` **|** Get all keys from the database\n```js\nDatabase.keyArray();\n```\n  - Types:\n    - Returns: Array\u003cany\u003e\n \n- `Database#getAll()` **|** Get all objects from the database\n```js\nDatabase.getAll();\n```\n  - Types:\n    - Returns: Array\u003cany\u003e\n\t\n- `Database#pull(key, value)` **|** Remove an item from an array\n```js\nawait Database.set('companies', ['Google', 'Facebook'])\nDatabase.pull('companies', 'Google'); // ['Facebook']\n```\n  - Types:\n    - Returns: Object\n\t\n- `Database#push(key, value)` **|** Add an item from an array\n```js\nawait Database.set('companies', ['Facebook'])\nDatabase.pull('companies', 'Google'); // ['Facebook', 'Google']\n```\n  - Types:\n    - Returns: Object\n\t\n- `Database#push(key, value)` **|** Add an item from an array\n```js\nawait Database.set('companies', ['Amazon'])\nDatabase.includes('companies', 'Amazon'); // true\n```\n  - Types:\n    - Returns: boolean\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavipatricio%2Feasy-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavipatricio%2Feasy-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavipatricio%2Feasy-mongodb/lists"}