{"id":18961949,"url":"https://github.com/lamualfa/i18next-node-mongodb-backend-next","last_synced_at":"2025-04-19T11:52:35.324Z","repository":{"id":48740512,"uuid":"245658970","full_name":"lamualfa/i18next-node-mongodb-backend-next","owner":"lamualfa","description":"i18next mongodb backend","archived":false,"fork":false,"pushed_at":"2023-08-14T09:02:45.000Z","size":1873,"stargazers_count":11,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T07:33:32.126Z","etag":null,"topics":["i18next","i18next-backend","i18next-mongodb-backend","mongo","mongodb","nodejs"],"latest_commit_sha":null,"homepage":"https://www.i18next.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamualfa.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":"2020-03-07T15:38:23.000Z","updated_at":"2025-02-20T22:11:03.000Z","dependencies_parsed_at":"2022-09-02T00:40:59.532Z","dependency_job_id":null,"html_url":"https://github.com/lamualfa/i18next-node-mongodb-backend-next","commit_stats":null,"previous_names":["laodemalfatih/i18next-node-mongo-backend"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fi18next-node-mongodb-backend-next","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fi18next-node-mongodb-backend-next/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fi18next-node-mongodb-backend-next/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fi18next-node-mongodb-backend-next/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamualfa","download_url":"https://codeload.github.com/lamualfa/i18next-node-mongodb-backend-next/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249195428,"owners_count":21228199,"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":["i18next","i18next-backend","i18next-mongodb-backend","mongo","mongodb","nodejs"],"created_at":"2024-11-08T14:14:48.521Z","updated_at":"2025-04-16T04:33:04.863Z","avatar_url":"https://github.com/lamualfa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://badgen.net/npm/v/i18next-node-mongodb-backend-next?color=red)](https://www.npmjs.com/package/i18next-node-mongodb-backend-next)\n[![license](https://badgen.net/github/license/lamualfa/i18next-node-mongodb-backend-next?color=purple)](https://github.com/lamualfa/i18next-node-mongodb-backend-next/blob/master/LICENSE)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n## Are you a Deno user? If `true`, we provide the same library for Deno. See: [Mongo Backend for Deno](https://github.com/lamualfa/dn-i18next-mongo-backend) 🦖\n\n#### Inspired from [i18next-node-mongodb-backend](https://github.com/gian788/i18next-node-mongodb-backend) with support for `mongodb@3.5.x` and some bug fixes and more improvements\n\n# Integrate [i18next](https://github.com/i18next/i18next) with [MongoDB](https://www.mongodb.com/)\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/banner.png\" alt=\"Banner\"/\u003e\n\u003c/div\u003e\n\n# Introduction\n\nThis is a [i18next](https://github.com/i18next/i18next) backend to be used Node JS. It will load resources from a [MongoDB](https://www.mongodb.org) database with official node mongodb [driver](https://mongodb.github.io/node-mongodb-native/3.5/).\n\n\u003e Prevously is **i18next-node-mongo-backend**. Because i lost my NPM account, the package was renamed to **i18next-node-mongodb-backend-next**.\n\n# Getting started\n\n```bash\nyarn add mongodb i18next-node-mongodb-backend-next\n# or\nnpm install mongodb i18next-node-mongodb-backend-next\n```\n\n\u003e Important: This library doesn't include `mongodb` library. You need to install it yourself.\n\n# Usage\n\n```js\nconst i18next = require('i18next');\nconst Backend = require('i18next-node-mongodb-backend-next');\n\ni18next.use(Backend).init({\n  // Backend Options\n  backend: options,\n});\n```\n\n# Backend Options\n\n```js\n{\n  // Database Name\n  dbName: '\u003cDB Name\u003e', // Required\n\n  // MongoDB Uri\n  uri: '\u003cDB URI\u003e',\n\n  // Or\n\n   // MongoDB standard configuration\n  host: '\u003cDB Host\u003e',\n  port: 27017,\n\n  // Or\n\n  // If you have your own `MongoClient`, put in here:\n  // Note: If this has already been entered, the other MongoDB configurations will be ignored\n  client: new MongoClient(), // work with connected client or not\n\n  // MongoDB authentication. Remove it if not needed\n  // Choose one, `user` or `username`. Both are the same.\n  user: '\u003cDB User\u003e',\n  username: '\u003cDB User\u003e',\n  password: '\u003cDB Password\u003e',\n\n  // Collection name in database will be used to store i18next data\n  collectionName: 'i18n',\n\n  // MongoDB field name\n  languageFieldName: 'lang',\n  namespaceFieldName: 'ns',\n  dataFieldName: 'data',\n\n  // Remove MongoDB special character from field name. See https://jira.mongodb.org/browse/SERVER-3229\n  sanitizeFieldNameCharacter: true,\n\n  // Error handlers\n  readOnError: console.error,\n  readMultiOnError: console.error,\n  createOnError: console.error,\n\n  // MongoClient Options. See https://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n  mongodb: {\n    useUnifiedTopology: true\n  }\n};\n```\n\n## Example Backend Options\n\n#### Connect with `uri`:\n\n```js\n{\n  uri: 'mongodb://localhost:27017/test',\n  dbName: 'test' // Required field\n}\n```\n\n#### Connect with `host` and `port`:\n\n```js\n{\n  host: 'localhost',\n  port: 27017,\n  dbName: 'test' // Required field\n}\n```\n\n#### Connect with `MongoClient` instance (_Recommended_):\n\nIf you already have your own connection, use this to avoid useless connections\n\n```js\n{\n  client: new MongoClient(), // Change with your MongoClient instance\n  dbName: 'test', // Required field\n}\n```\n\n## Example of the MongoDB document that will be created:\n\n```json\n{\n  \"lang\": \"en-US\",\n  \"ns\": \"translations\",\n  \"data\": {\n    \"key\": \"Thank you!\"\n  }\n}\n```\n\n\u003e Key name is according to provided in options\n\n## Visit [here](https://github.com/lamualfa/i18next-node-mongodb-backend-next/tree/v0.x-examples) for more example usage\n\n# Changelog:\n\n### v1.0.1 (_19-05-2022_)\n\n- Add support to both of `user` \u0026 `username` options.\n\n### v1.0.0 (_19-05-2022_)\n\n- Add support to `mongodb` v4 https://github.com/lamualfa/i18next-node-mongodb-backend-next/issues/18\n- Refactor the entire codebase\n- Testing improvement\n\n### v0.0.5 (_13-07-2021_):\n\n- Package renamed to `i18next-node-mongodb-backend-next`\n- Fix [#9 - error collection already exists](https://github.com/lamualfa/i18next-node-mongodb-backend-next/pull/9)\n\n### v0.0.4 (_08-04-2020_):\n\n- Critical bug fixed\n- Remove `persistConnection` option\n- Rename `filterFieldNameCharacter` option to `sanitizeFieldNameCharacter`\n\n### v0.0.3 (_DEPRECATED_):\n\n- Add testing code with [Jest](https://jestjs.io/)\n- Add [JSDOC](https://jsdoc.app/)\n- Add support for the `uri` option\n- Add `filterFieldNameCharacter` option\n- Some improvements\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamualfa%2Fi18next-node-mongodb-backend-next","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamualfa%2Fi18next-node-mongodb-backend-next","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamualfa%2Fi18next-node-mongodb-backend-next/lists"}