mongoose-detective

2.0.0 • Public • Published

mongoose-detective Build Status NPM version js-standard-style

Find the referenced model name at a specified path

npm i mongoose-detective --save

Usage

const detective = require('mongoose-detective')
const mongoose = require('mongoose')

const InvoiceSchema = new Schema({
  customer: { type: mongoose.Schema.Types.ObjectId, ref: 'Customer' }
})

mongoose.model('Invoice', InvoiceSchema)

const modelName = detective(mongoose.models.Invoice, 'customer')

// modelName = 'Customer'

Contributing

I'd love for you to contribute and make mongoose-detective even better than it is today!

git clone https://github.com/Zertz/mongoose-detective.git
npm install
npm test

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i mongoose-detective

    Weekly Downloads

    1,897

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    3.74 kB

    Total Files

    5

    Last publish

    Collaborators

    • zertz