{"id":14969931,"url":"https://github.com/ghostbar/hapi-mongodb2","last_synced_at":"2026-02-26T20:04:13.879Z","repository":{"id":25309044,"uuid":"28735685","full_name":"ghostbar/hapi-mongodb2","owner":"ghostbar","description":"Hapi's MongoDB native driver 2.0 plugin","archived":false,"fork":false,"pushed_at":"2015-10-23T00:13:51.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T18:47:56.010Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghostbar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2015-01-03T05:14:07.000Z","updated_at":"2015-09-07T23:10:46.000Z","dependencies_parsed_at":"2022-07-25T12:32:08.138Z","dependency_job_id":null,"html_url":"https://github.com/ghostbar/hapi-mongodb2","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostbar%2Fhapi-mongodb2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostbar%2Fhapi-mongodb2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostbar%2Fhapi-mongodb2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostbar%2Fhapi-mongodb2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghostbar","download_url":"https://codeload.github.com/ghostbar/hapi-mongodb2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240063929,"owners_count":19742227,"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-09-24T13:42:42.738Z","updated_at":"2026-02-26T20:04:08.847Z","avatar_url":"https://github.com/ghostbar.png","language":"JavaScript","readme":"hapi-mongodb2\n=============\n\nHapi (^8.0) plugin for the MongoDB native driver 2.0.\n\nInstall\n-------\n\n    npm install --save mongodb@2 hapi-mongodb2\n\nRegister plugin\n---------------\n\n    var Hapi = require('hapi');\n    var server = new Hapi.Server();\n\n    server.register({\n      register: require('hapi-mongodb2')\n      opts: { url: 'mongodb://user:password@domain.tld:port/database' }\n    }, function (err) {\n      if (err) console.error(err);\n    });\n\nUse plugin\n----------\n\nThe object returned by `MongoClient.connect` is exposed on `server.plugins['hapi-mongodb2'].client` and binded to the context on routes and extensions as `this.mongo`.\n\nIf by any chance you need to use the `mongodb` library itself you can get it from `server.plugins['hapi-mongodb2'].library`.\n\n    server.route({\n      method: 'GET',\n      path: '/users',\n      handler: function (request, reply) {\n        var mongo = request.server.plugins['hapi-mongodb2'].client;\n        mongo.collection('users').find({}).toArray(function (err, users) {\n          reply(users);\n        });\n      }\n    }, {\n      method: 'GET',\n      path: '/databases',\n      handler: function (request, reply) {\n        var mongo = this.mongo;\n        mongo.admin().listDatabases(function (err, dbs) {\n          reply(dbs);\n        });\n      }\n    });\n\nLicense\n-------\n\nLicensed under the terms of the ISC. A copy of the license can be found in the file `LICENSE`.\n\n© 2015, Jose-Luis Rivas `\u003cme@ghostbar.co\u003e`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostbar%2Fhapi-mongodb2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostbar%2Fhapi-mongodb2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostbar%2Fhapi-mongodb2/lists"}