slugify-mongoose

1.0.2 • Public • Published

slugify-mongoose

Generate a unique slug for mongoose.

Installation

npm i --save slugify-mongoose

Usage

const slugify = require('slugify-mongoose')
 
const mongoose = require('mongoose')
const Schema = mongoose.Schema
 
const mySchema = new Schema({
    title: { type: String },
    slug: { type: String, slug: 'title', unique: true },
})
 
mySchema.plugin(slugify)

Info

There are currently a lot of plugins for mongoose that already generate slugs, I made this because none of them worked with the web framework feathers.

This plugin also works with keystone.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    83
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    83
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i slugify-mongoose

Weekly Downloads

84

Version

1.0.2

License

MIT

Last publish

Collaborators

  • ellipticaldoor