{"id":15061692,"url":"https://github.com/lependu/fastify-mongojs","last_synced_at":"2026-01-03T02:05:23.743Z","repository":{"id":57233326,"uuid":"144707658","full_name":"lependu/fastify-mongojs","owner":"lependu","description":"Simple wrapper around mongojs to share common connection pool across Fastify server.","archived":false,"fork":false,"pushed_at":"2020-05-11T17:15:41.000Z","size":27,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T09:40:23.022Z","etag":null,"topics":["fastify","fastify-plugin","mongodb","mongojs"],"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/lependu.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}},"created_at":"2018-08-14T10:54:03.000Z","updated_at":"2020-07-30T12:56:24.000Z","dependencies_parsed_at":"2022-08-31T20:51:15.070Z","dependency_job_id":null,"html_url":"https://github.com/lependu/fastify-mongojs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lependu%2Ffastify-mongojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lependu%2Ffastify-mongojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lependu%2Ffastify-mongojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lependu%2Ffastify-mongojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lependu","download_url":"https://codeload.github.com/lependu/fastify-mongojs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243723160,"owners_count":20337321,"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":["fastify","fastify-plugin","mongodb","mongojs"],"created_at":"2024-09-24T23:23:43.371Z","updated_at":"2026-01-03T02:05:18.712Z","avatar_url":"https://github.com/lependu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-mongojs\n\nSimple wrapper around [mongojs](https://github.com/mafintosh/mongojs) to share common connection pool across [Fastify](https://github.com/fastify/fastify) server.  \n:warning: This project is **experimental** if you need something stable, take a look at [fastify-mongodb](https://github.com/fastify/fastify-mongodb)  \n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)\n[![Build Status](https://travis-ci.org/lependu/fastify-mongojs.svg?branch=master)](https://travis-ci.org/lependu/fastify-mongojs)\n[![Known Vulnerabilities](https://snyk.io/test/github/lependu/fastify-mongojs/badge.svg)](https://snyk.io/test/github/lependu/fastify-mongojs)\n[![Coverage Status](https://coveralls.io/repos/github/lependu/fastify-mongojs/badge.svg?branch=master)](https://coveralls.io/github/lependu/fastify-mongojs?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/lependu/fastify-mongojs.svg)](https://greenkeeper.io/)\n\n## Install\n```\n$ npm i --save fastify-mongojs \n```\n\n## Example\n```js\n  const Fastify = require('fastify')\n  const fastifyMongojs = require('fastify-mongojs')\n  \n  const fastify = Fastify()\n\n  fastify.register(fastifyMongojs, { \n    name: 'myMongo',\n    url: 'myDb',\n    collections: ['awesome_collection']\n  })\n\n  fastify.get('/', function(req, reply) =\u003e {\n    // You can reach the db connection with fastify.myMongo\n  })\n\n  fastify.listen(3000, err =\u003e {\n    if (err) throw err\n  })  \n```\n\n## Reference\nname | type | required | default \n-----| :------: | :----------: |---------\n**`name`** | `{String}` | :x: | `'mongo'`  \n**`url`** | `{String}` | :heavy_check_mark: |   \n**`collections`** | `{Array}` | :x: | `[]`   \n  \nThe only plugin specific option is `name` which makes possible to share multiple connection pools across the server instance.\nThe `url` and `collections` options will be passed to mongojs separately, all other options will be passed to the mongojs instance as well.\nFor more information about the avaiable options please see [mongojs](https://github.com/mafintosh/mongojs).  \n  \n## Caveats\nDue the recent changes in [mongodb](https://github.com/mongodb/node-mongodb-native) if you pass mongodb connection to mongojs it will fail.\nThere is a [PR](https://github.com/mafintosh/mongojs/pull/353) in place which needs to be published first, to imlement this feature.  \n  \n## License\nLicensed under [MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flependu%2Ffastify-mongojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flependu%2Ffastify-mongojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flependu%2Ffastify-mongojs/lists"}