Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

mongoose-latinize

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-latinize

store the latin form of a String field for easy searching

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

mongoose-latinize

store the latin form of a String field for easy searching

usage

var mongoose_latinize = require('mongoose-latinize');
var user = new mongoose.Schema({ first_name: String });
user.plugin(mongoose_latinize, 'first_name');

This adds a new path to your schema, latin_first_name, storing the lower-case, latinized copy of first_name.

var user1 = new user({ first_name : 'Björk' });
user1.save(function(err, doc) {
    console.log(doc.latin_first_name); // returns 'bjork'
});

options

You can pass a simple string containing the property name (as above), or an object, with the following

  • prop - string, required - the data source for the latin_-prefixed property
  • index - bool, defaults true - creates an index on the latin_-prefixed property for fast searching
  • json - bool, defaults false - determines whether to include the latinized property when calling .toJSON()

For example, to not use an index and to include the properties in JSON transforms:

var user = new mongoose.Schema({ first_name: String });

user.plugin(mongoose_latinize, {
    prop: 'first_name',
    index: false,
    json: true
});

Keywords

mongoose

FAQs

Package last updated on 15 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts