https://github.com/capaj/mongoose-schema-serializer
serialize and deserialize your mongoose schema with this
https://github.com/capaj/mongoose-schema-serializer
Last synced: about 1 year ago
JSON representation
serialize and deserialize your mongoose schema with this
- Host: GitHub
- URL: https://github.com/capaj/mongoose-schema-serializer
- Owner: capaj
- License: mit
- Created: 2016-01-23T11:27:05.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-05T13:22:38.000Z (over 10 years ago)
- Last Synced: 2025-06-04T22:15:15.436Z (about 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongoose-schema-serializer
serialize and deserialize your mongoose schema with this simple JSON stringifier/reviver
Useful, when you need to send your schema over the network-for example to your admin frontend.
## Install
```
npm i mongoose-schema-serializer
```
## Usage
```javascript
var Schema = mongoose.Schema //on the frontend you can provide an object with same structure to satisfy it
const mss = require('../index')(Schema)
// mss2 one will deserialize ObjectId and Mixed as strings.
const mss2 = require('../index')()
const json = mss.stringify(schema)
// then on frontend
const schema = mss2.parse(json)
```