Not Particularly Meaningful

    mongoose-extras

    0.0.1-pre • Public • Published

    Mongoose Extras

    =====================================

    Provides Custom Schema Types support for Mongoose.

    Example:

    var mongoose = require('mongoose')
    require('mongoose-extras')( mongoose );
     
    //inside your model
    var Schema = mongoose.Schema
      , IP = mongoose.Schema.Types.IP
      , exampleSchema = new Schema({ ipAddress: IP });
     
    //or
    var Schema = mongoose.Schema
      , exampleSchema = new Schema({ ipAddress: 'IP' });

    Search Example:

    //in mongoose schema make sure you have a flag on searchable fields example
    var exampleSchema = new Schema({ ipAddress: IP, searchable: true });
        , Collection = mongoose.model('collection');
        , options
    //search the the first 10 records on the collection where ip matches 127.0.0.1
    options = {
        items: 10,
        page: 1,
        match: {
            ipAddress: '127.0.0.1'
        }
    }
     
    Collection.list( options, function( err, collections ) {
        //parse your callback just like any other mongoose callbacks.
    });

    Install

    npm i mongoose-extras

    DownloadsWeekly Downloads

    0

    Version

    0.0.1-pre

    License

    MIT

    Last publish

    Collaborators

    • slashhatim