Skip to content

Commit

Permalink
Support id generation compatible with MongoDB, typicode#245, typicode#39
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiokim committed Mar 29, 2016
1 parent b9b32ea commit f39ad84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lowdb": "^0.10.0",
"method-override": "^2.1.2",
"morgan": "^1.3.1",
"node-uuid": "^1.4.2",
"node-uuid": "^1.4.7",
"object-assign": "^4.0.1",
"pluralize": "^1.1.2",
"server-destroy": "^1.0.1",
Expand Down
3 changes: 3 additions & 0 deletions src/server/router/plural.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var express = require('express')
var _ = require('lodash')
var pluralize = require('pluralize')
var utils = require('../utils')
var uuid = require('node-uuid')

module.exports = function (db, name) {

Expand Down Expand Up @@ -209,6 +210,8 @@ module.exports = function (db, name) {
req.body[key] = utils.toNative(req.body[key])
}

req.body.id = uuid.v4();

var resource = db(name)
.insert(req.body)

Expand Down

0 comments on commit f39ad84

Please sign in to comment.