Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

express-restify-mongoose

florianholzapfel8.9kMIT9.0.5TypeScript support: included

Easily create a flexible REST interface for mongoose models

ReST, express, restify, mongodb, mongoose, model

readme

express-restify-mongoose

Easily create a flexible REST interface for mongoose models.

Build Status npm version

Getting started

npm install express-restify-mongoose --save

Documentation

https://florianholzapfel.github.io/express-restify-mongoose/

Compatibility

This library Mongoose MongoDB NodeJS
>= 9.0.0 6.x - 8.x 3.6.x - 7.x >=16
>= 8.0.0 6.x 3.6.x - 6.x >=18
>= 7.0.0 6.x 3.6.x - 6.x >=14
>= 6.0.0 5.8.0 - 6.x 3.6.x - 6.x >=6
>= 1.0.0 4.x 2.4 - 3.4 >=0.10
0.7.5 3.x 2.4 - 3.0 *

Contributing

Found a bug or have a suggestion to make? Have a took at issues or open a new one.

Everyone is welcome to contribute code by creating a pull request, just make sure to follow standard style.

Many thanks to all contributors!

License (MIT)

Copyright (C) 2013 by Florian Holzapfel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

changelog

Changelog

7.0.0

This release requires mongoose 6.x

  • updated mongoose to version 6.x

6.0.0

This release requires mongoose ~5.8

  • updated mongoose to version 5.8

5.0.0

  • dropped support for Node 4 and added support for Node 10
  • removed query operator parsing #285
  • moved request query in req.erm.query #299 #353
  • removed next from postProcess #334
  • added error when skip and/or limit is not a valid integer
  • removed _id tinkering #326
  • removed dependency on async

4.3.0

  • added support for async outputFn by returning a Promise

4.2.2

  • removed dependency on lodash, use specific modules and native methods when possible #352

4.2.1

4.2.0

  • removed compile step, code now runs natively on Node 4+ and babel is only used for coverage

4.1.1

  • fixed distinct queries when options.totalCountHeader is enabled

4.1.0

  • improved sync error handling in buildQuery by wrapping in a promise
  • fixed crash when distinct and sort operators were used in the same query

4.0.0

  • improved default error middleware by serializing error objects and removing stack traces
  • fixed Mongoose async middleware error propagation
  • fixed requests to always set req.erm.statusCode
  • removed statusCode from error object and response body
  • removed undocumented outputFn parameter, use req.erm.result and req.erm.statusCode

3.2.0

  • added an option to disable regex operations (#195)
  • fixed queries with an idProperty resulting in a CastError to return 404 instead of 400 (#184)
  • fixed query parser to handle geospatial operators (#187)

3.1.0

  • critical security fix with the distinct operator, see issue #252 for details

3.0.0

  • ported source to ES2015, compiled and published as ES5 with Babel
  • document filtering is now done right before output allowing access to the full document in post middleware
  • removed options.lowercase and options.plural, use options.name = require('inflection').pluralize('modelName').toLowerCase()

2.0.0

  • changed serve to no longer returns an Express 4 router, now returns the resource's base path (ie.: /api/v1/Customer)
  • changed options.private and options.protected to no longer accept comma separated fields, pass an array instead
  • removed options.excluded, use options.private
  • removed support for querying directly with query parameters, use url?query={"name":"hello"}
  • removed $and and $or query parameters, use url?query={"$or":[...]}
  • removed prereq, use preMiddleware instead
  • changed postCreate, postUpdate, and postDelete signatures to (req, res, next)
  • deprecated outputFn's data parameter, data now available on req.erm.result and req.erm.statusCode

1.0.0

This release requires mongoose ~4

  • updated mongoose to version 4
  • removed fullErrors, implement a custom onError handler instead
  • removed strict option, allows DELETE without id and POST with id, disallows PUT without id
  • async prereq and access now use the standard (err, data) callback signature
  • access will throw an exception when an unsupported value is passed
  • changed outputFn's signature to: (req, res, { result: result, statusCode: statusCode })

0.7.0

This release requires mongoose ~3