mongoose-snake-to-camel
A Mongoose plugin that creates camelCase aliases (virtuals) for snake_case properties. This was inspired by/refactored from mongoose-convention by Vadim Tyokov.
Installation
npm install mongoose-snake-to-camel
Usage
var mongoose = Schema = mongooseSchema snakeToCamel = ; var schema = _hello: type: SchemaTypesMixed doNotChange: type: SchemaTypesMixed foo_bar: type: SchemaTypesMixed what__is___this: type: SchemaTypesMixed ; schema; var Thing = mongoose;var thing = fooBar: 'foo bar'; console; //"foo bar"console; //"foo bar" thingwhatIsThis = 'snakes'; console; //"snakes"console; //"snakes" console; //true consoledirthing;/*{ id: ..., //_id is converted to id automatically hello: ..., fooBar: ..., doNotChange: ..., whatIsThis: ...}*/