{"id":19142351,"url":"https://github.com/eldoy/mongowave","last_synced_at":"2026-02-05T12:31:20.403Z","repository":{"id":139868618,"uuid":"219831408","full_name":"eldoy/mongowave","owner":"eldoy","description":"Javascript MongoDB database client","archived":false,"fork":false,"pushed_at":"2024-07-25T12:59:08.000Z","size":891,"stargazers_count":2,"open_issues_count":26,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T22:04:13.165Z","etag":null,"topics":[],"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/eldoy.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":"2019-11-05T19:14:52.000Z","updated_at":"2024-07-25T12:59:14.000Z","dependencies_parsed_at":"2024-05-17T13:29:42.066Z","dependency_job_id":"3a9d2ead-fad1-41cd-a81f-fb925f32ca5e","html_url":"https://github.com/eldoy/mongowave","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldoy/mongowave","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmongowave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmongowave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmongowave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmongowave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/mongowave/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmongowave/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29121760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T10:47:47.471Z","status":"ssl_error","status_checked_at":"2026-02-05T10:45:08.119Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-09T07:26:55.964Z","updated_at":"2026-02-05T12:31:20.383Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mongowave MongoDB Client\n\nJavascript MongoDB database client boasting the following features:\n\n* Intuitive API\n* Automatic timestamps (created_at, updated_at)\n* Custom string id\n* Using id instead of _id\n* Insert, update and delete multiple by default\n* Returns full object on create\n* Updates with $set by default\n* Retry connection on fail\n\n### Install\n`npm i mongowave`\n\n### Usage\n\nConnect to database:\n```js\nconst connection = require('mongowave')\n```\n\nDefault options:\n```js\nconst db = await connection({\n  // URL of database server\n  url: 'mongodb://localhost:27017',\n\n  // Name of database\n  name: 'wdb',\n\n  // Automatically set created_at and updated_at fields on change\n  timestamps: true,\n\n  // Function used to generate ids\n  id: cuid,\n\n  // Use 'id' instead of '_id'\n  simpleid: true,\n\n  // The default size for batch queries\n  batchsize: 20,\n\n  // Suppress logging\n  quiet: false,\n\n  // Connection options for Mongodb Client\n  connection: {\n    useNewUrlParser: true,\n    useUnifiedTopology: true\n  },\n\n  // Always convert id to string\n  stringid: true\n})\n```\n\nIf you want to use underscore ids and ObjectIds (default MongoDB behavior):\n```js\nconst db = await connection({\n  // Let MongoDB generate id\n  id: false,\n\n  // Use '_id' instead of 'id'\n  simpleid: false\n})\n```\n\nInsert document:\n```js\n// Returns the full document:\n// { id: '507f191e810c19729de860ea', name: 'hello' }\n// Takes only 1 argument: values\nconst result = await db('project').create({ name: 'hello' })\n```\n\nInsert multiple documents:\n```js\n// Returns the full documents:\n// [\n//   { id: '507f191e810c19729de860ea', name: 'hello' },\n//   { id: '607f191e810c19729de860eb', name: 'bye' }\n// ]\n// Takes only 1 argument: values, must be array of objects\nconst result = await db('project').create([{ name: 'hello' }, { name: 'bye' }])\n```\n\nUpdate document (updates multiple if query matches):\n```js\n// Returns the number of updated documents: { n: 1 }\n// Takes 2 arguments: query, values\nconst result = await db('project').update({ id: '507f191e810c19729de860ea' }, { name: 'bye' })\n```\n\nDelete document (deletes multiple if query matches):\n```js\n// Returns the number of deleted documents: { n: 1 }\n// Takes 1 argument: query\nconst result = await db('project').delete({ id: '507f191e810c19729de860ea' })\n```\n\nFind documents, all of [the mongodb query operators](https://docs.mongodb.com/manual/reference/operator/query/) work:\n```js\n// Returns an array of matching documents\n// Takes 2 arguments: query, options\n\n// Find all\nconst result = await db('project').find()\n\n// Find all with name 'bye'\nconst result = await db('project').find({ name: 'bye' })\n\n// Find with sorting on 'name' field descending, use 1 for ascending\nconst result = await db('project').find({}, { sort: { name: -1 } })\n\n// Find only 2\nconst result = await db('project').find({}, { limit: 2 })\n\n// Find but skip 2\nconst result = await db('project').find({}, { skip: 2 })\n\n// Find all but don't include the 'name' field in the result\nconst result = await db('project').find({}, { fields: { name: false } })\n\n// Find all with 'level' field greater than 5\nconst result = await db('project').find({ level: { $gt: 5 }})\n```\n\nGet document:\n```js\n// Returns the first matching document\n// Takes 2 arguments: query, options\nconst result = await db('project').get({ name: 'bye' })\n```\n\nCount documents:\n```js\n// Returns the count of the matching query\n// Takes 2 arguments: query, options\nconst result = await db('project').count({ name: 'bye' })\n```\n\nNull values:\n```js\n// Creates doc with null name field\nconst result = await db('project').create({ name: null })\n\n// Returns all docs with null name field\nconst result = await db('project').find({ name: null })\n\n// Sets all name fields to null\nconst result = await db('project').update({}, { name: null })\n```\n\nUndefined values:\n```js\n// Creates doc without name field\nconst result = await db('project').create({ name: undefined })\n\n// Returns all docs without name field\nconst result = await db('project').find({ name: undefined })\n\n// Unsets all name fields\nconst result = await db('project').update({}, { name: undefined })\n```\n\nUse the mongodb client base directly:\n```js\ndb.base.collection('project').findOne({ _id: insert.id })\n```\n\nThe mongodb client:\n```js\ndb.client\n```\n\nMongoDB ObjectId short cut:\n```js\n// Generate a new ID\ndb.id()\n```\n\nThere's also `set`, `search`, `batch`, `each`, `aggregate`, `index`, `deindex`, `dups` and `analyze`. Read the source code to find out how to use them.\n\nMIT Licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fmongowave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fmongowave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fmongowave/lists"}