mongoose-by-hash

1.1.3 • Public • Published

mongoose-by-hash

A plugin to use hashes as the main method

TODO: Pending add more checks, test and documentation

Installation

The best way to install it is using npm

npm install mongoose-by-hash --save

Loading

var FindByHash = require('mongoose-by-hash');
 

Initialization and Usage

Basic usage (you can see how works better with test:

 
/* Setup */
mongoose.set('debug', true);
mongoose.connect('mongodb://localhost/mongoose-by-hash');
 
Resource = new mongoose.Schema({
    title: {type: String}
},{timestamps:true});
 
Resource.plugin(FindByHash, {name: 'sweetThing', 'default': "shortid"});
mongoose.model('Resource', Resource);
 
 
Resource = new mongoose.Schema({
    title: {type: String}
},{timestamps:true});
 
Resource.plugin(FindByHash, {'default': "uuid"});
mongoose.model('ResourceUUID', Resource);
 
 
 
Resource = new mongoose.Schema({
    title: {type: String}
},{timestamps:true});
 
Resource.plugin(FindByHash, {'default': function(){return hashExample}});
mongoose.model('ResourceFunction', Resource);
 
 

Support

This plugin is proudly supported by Kubide hi@kubide.es

Readme

Keywords

Package Sidebar

Install

npm i mongoose-by-hash

Weekly Downloads

8

Version

1.1.3

License

MIT

Unpacked Size

16.7 kB

Total Files

11

Last publish

Collaborators

  • dev.kubide
  • gelito
  • jolorenzom