首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用复合时,我在使用validatesPresenceOf时出现了更新错误

使用复合时,我在使用validatesPresenceOf时出现了更新错误
EN

Stack Overflow用户
提问于 2013-04-01 02:38:25
回答 1查看 296关注 0票数 0

我正在用复合mongodb创建一个应用程序。复合使用jugglingdb和jugglingdb-mongodb连接到mongodb。

我用化合物的脚手架为客户生成了一个crud。然后,我将Client.validatesPresenceOf('name');添加到app/model/client.js中。

代码语言:javascript
复制
module.exports = function (compound, Client) {
  Client.validatesPresenceOf('name');
};

在创建时,它可以工作,但是在更新时它会失败。

我还尝试将验证添加到db/schema.js,但得到了相同的错误。

这就是我所犯的错误

/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:529抛出错误;^ Error:无法在发送后设置标头。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/node_modules/connect/lib/patch.js:59:22) at ServerResponse.res.set.res.header (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:518:10) at ServerResponse.res.location (/User/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:649:8) at ServerResponse.res.redirect (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:691:8) at Controller.Helpers.redirect (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:168:14) at Controller.Helpers.redirect at (/Users/camilo )/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17),:97:38)在(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:43:17)的Object.html:93:20)在(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:38:5) at action.cliente.destroy.format.json.send.code ( (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17),:84:9)在ModelConstructor。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:827:33) at ModelConstructor.next (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/hooks.js:48:18) at ModelConstructor.(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:826:38) at ModelConstructor.next (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/hooks.js:48:18) at /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:825:30 at /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/lib/mongodb.js:249:9 at /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/collection.js:703:14为null。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/db.js:1709:18) at g (events.js:175:14) at EventEmitter.emit (events.js:106:17) at Server.Base._callHandler (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/base.js:130:25) at /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:464:24 at MongoReply.parseBody (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:132:5) at null。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:410:22) at EventEmitter.emit (events.js:95:17)为null。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:190:13) at EventEmitter.emit (events.js:98:17)在套接字处。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection.js:382:22) at Socket.EventEmitter.emit (events.js:95:17)在套接字处。(_stream_readable.js:699:14)在Socket.EventEmitter.emit (events.js:92:17) at emitReadable_ (_stream_readable.js:382:10) at emitReadable (_stream_readable.js:377:5) at readableAddChunk (_stream_readable.js:142:7) at Socket.Readable.push (_stream_readable.js:112:10) at TCP.onread (net.js:511:21)

版本:

  • nodejs: 0.10.1
  • 复合物: 1.1.5-21
  • jubblingdb: 0.2.0-27
  • 杂耍数据库-mongodb: 0.0.4-1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-01 16:55:36

这个问题是jubblingdb 0.2.0-27上的一个bug。作者将其更新为0.2.028,解决了问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15736954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档