/mongoose-i18n

Mongoose schema plugin for i18n support.

Primary LanguageCoffeeScript

Mongoose i18n Schema Plugin

Surprisingly there is not a proper plugin for this. I found a couple gists that do this:

I didn’t see anything in the npm repo, so...

Usage

Install:

npm i --save mongoose mongoose-i18n

Create your schema:

mongoose = require 'mongoose'
i18nPlugin = require 'mongoose-i18n'

# ... create your schema, e.g. MySchema ... #

MySchema.plugin i18nPlugin, languages: ['en', 'fr'], defaultLanguage: 'en'