{"id":20908666,"url":"https://github.com/benoitclaveau/damless-mongo","last_synced_at":"2025-09-18T17:29:01.655Z","repository":{"id":135255731,"uuid":"129213919","full_name":"BenoitClaveau/damless-mongo","owner":"BenoitClaveau","description":"Mongo service for dambreaker","archived":false,"fork":false,"pushed_at":"2021-03-02T14:05:35.000Z","size":215,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-27T09:17:19.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/BenoitClaveau.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":"2018-04-12T07:51:48.000Z","updated_at":"2021-03-02T14:05:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e19695b-defd-4aad-9155-29c83e6e8316","html_url":"https://github.com/BenoitClaveau/damless-mongo","commit_stats":null,"previous_names":["benoitclaveau/dambreaker-mongo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitClaveau%2Fdamless-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitClaveau%2Fdamless-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitClaveau%2Fdamless-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitClaveau%2Fdamless-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenoitClaveau","download_url":"https://codeload.github.com/BenoitClaveau/damless-mongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243301128,"owners_count":20269286,"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","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-18T14:08:22.133Z","updated_at":"2025-09-18T17:28:56.595Z","avatar_url":"https://github.com/BenoitClaveau.png","language":"JavaScript","readme":"# damless-mongo\n[Mongo](https://www.npmjs.com/package/mongodb) service for [damless](https://www.npmjs.com/package/damless).\n\n [![NPM][npm-image]][npm-url]\n [![Build Status][travis-image]][travis-url]\n [![Coverage Status][coveralls-image]][coveralls-url]\n\n## Features\n\n * [damless](https://www.npmjs.com/package/damless)\n * [Mongo API](http://mongodb.github.io/node-mongodb-native/3.1/api/)\n\n## REST api\n\nMethod | Param | DamLess method\n --- | --- | ---\nGET | /:id | httpFindOne\nGET | /?\u003cquerystring\u003e | httpFind\nPOST | | httpInsertOne\nPUT | /:id | httpSaveOne\nPATCH | /:id | httpUpdateOne with $set\nDELETE | /:id | httpDeleteOne\n\n## Create an api\n\n```js\nconst { Http } = require(\"damless-mongo\");\nclass Api extends Http {\n\n    //giveme is the dependency injection service used by damless\n    constructor(giveme) {\n        super(giveme, \"\u003ccollectionName\u003e\");\n    };\n\n    ...\n}\n```\n\n## Http methods\n\nMethod | Description\n --- | --- \nhttpFindOne | \nhttpFind |\nhttpInsertOne |\nhttpInsertMany |\nhttpSaveOne |\nhttpUpdateOne |\nhttpSaveMany |\nhttpUpdateMany |\nhttpDeleteOne |\nhttpDeleteMany |\nhttpCount |\nhttpAggregate |\n\n## Stream methods\n\nMethod | Description\n --- | --- \nsaveOne | \nsave |\ninsertOne |\ninsert |\nupdateOne |\nupdate |\nreplaceOne |\ndeleteOne |\ndelete |\nfindOne |\nfind |\naggregate |\ncount |\n\n## Mongo api methods\n\nMethod | Description\n --- | --- \nmongoInsertOne |\nmongoInsertMany |\nmongoAggregate |\nmongoBulkWrite |\nmongoCreateIndex |\nmongoCreateIndexes |\nmongoCount |\nmongoCreateIndexes |\nmongoDeleteOne |\nmongoDeleteMany |\nmongoDistinct |\nmongoDrop |\nmongoDropIfExists |\nmongoDropIndex |\nmongoDropIndexes |\nmongoFindOne |\nmongoFind |\nmongoFindOneAndDelete |\nmongoFindOneAndReplace |\nmongoFindOneAndUpdate |\nmongoGeoHaystackSearch |\nmongoGeoNear |\nmongoGroup |\nmongoMapReduce |\nmongoReplaceOne |\nmongoSave |\nmongoUpdateOne |\nmongoUpdateMany |\n\n## Cutomize your api\n\n```js\nconst { Http } = require(\"damless-mongo\");\nconst { promisify } = require(\"util\");\nconst stream = require(\"stream\");\nconst pipeline = promisify(stream.pipeline);\n\nclass Api extends Http {\n\n    // giveme is the dependency injection service used by damless\n    constructor(giveme) {\n        super(giveme, \"\u003ccollectionName\u003e\");\n    };\n\n    // override the default httpFind an use Crud primitives\n    async httpFind(context, stream, headers) {\n        // get a mongo cursor\n        const cursor = this.findWords(context.query.q);\n        await pipeline(\n            cursor,\n            stream\n        );\n    }\n}\n```\n\n\n## Add the mongo connection string in damless.json\n\n```damless.json\n{\n\t\"mongo\": {\n        \"connectionString\": \"mongodb://localhost:27017/database\"\n    },\n}\n```\n\n## Inject damless-mongo service\n\n```services.json\n{\n  \"services\": [\n    { \"name\": \"mongo\", \"location\": \"damless-mongo\" }\n  ]\n}\n```\n\nOr in javascript\n\n```js\nconst DamLess = require(\"damless\");\nconst damless = new DamLess();\ndamless.inject(\"mongo\", \"damless-mongo\");\n```\n\n## Installation\n\n```bash\n$ npm install damless-mongo\n```\n\n## Test\n\nTo run our tests, clone the damless-mongo repo and install the dependencies.\n\n```bash\n$ git clone https://github.com/BenoitClaveau/damless-mongo --depth 1\n$ cd damless-mongo\n$ npm install\n$ mongod --dbpath ./data/db\n$ node.exe \"../node_modules/mocha/bin/mocha\" tests\n```\n\n[npm-image]: https://img.shields.io/npm/v/damless-mongo.svg\n[npm-url]: https://npmjs.org/package/damless-mongo\n[travis-image]: https://travis-ci.org/BenoitClaveau/damless-mongo.svg?branch=master\n[travis-url]: https://travis-ci.org/BenoitClaveau/damless-mongo\n[coveralls-image]: https://coveralls.io/repos/BenoitClaveau/damless-mongo/badge.svg?branch=master\u0026service=github\n[coveralls-url]: https://coveralls.io/github/BenoitClaveau/damless-mongo?branch=master\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitclaveau%2Fdamless-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitclaveau%2Fdamless-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitclaveau%2Fdamless-mongo/lists"}