Skip to content

Commit

Permalink
fixes #16
Browse files Browse the repository at this point in the history
version 0.2.6
  • Loading branch information
florianholzapfel committed Aug 17, 2013
1 parent 4a602a3 commit 38c25c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/express-restify-mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ var restify = function (app, model, options) {
}

function createObject(req, res, next) {
delete req.body._id;
delete req.body.__v;

model.create(req.body, function (err, item) {
if (err) {
res.send(400, 'Bad request');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "express-restify-mongoose",
"description": "Easily restify mongoose database",
"version": "0.2.5",
"version": "0.2.6",
"author": {
"name": "Florian Holzapfel",
"email": "[email protected]"
Expand Down
4 changes: 3 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ function Restify() {
url: util.format('%s/api/v1/Customers', testUrl),
json: {
name: 'Test',
comment: 'Comment'
comment: 'Comment',
_id: null
}
}, function (err, res, body) {
assert.equal(res.statusCode, 200, 'Wrong status code');
assert.ok(body._id, '_id is not set');
assert.equal(body.name, 'Test');
assert.equal(body.comment, 'Comment');
savedCustomer = body;
Expand Down

0 comments on commit 38c25c0

Please sign in to comment.