使用compound,我在使用validatesPresenceOf时出现更新错误

时间:2013-04-01 02:38:25

标签: node.js compoundjs jugglingdb

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

我使用化合物的脚手架为客户生成了一个小问题。然后,我将Client.validatesPresenceOf('name');添加到a​​pp / models / client.js

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           扔错了;                 ^   错误:发送后无法设置标头。       在ServerResponse.OutgoingMessage.setHeader(http.js:708:11)       在ServerResponse.res.setHeader(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/node_modules/connect/lib/patch.js:59:22)       在ServerResponse.res.set.res.header(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:518:10)       在ServerResponse.res.location(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:649:8)       在ServerResponse.res.redirect(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:691:8)       在Controller.Helpers.redirect(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:168:14)       在eval(eval at(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17),:97:38)       在Object.html(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:43:17)       在eval(eval at(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17),:93:20)       在Controller.respondTo(/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(eval at(/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)       在ModelConstructor.next(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/hooks.js:48:18)       在ModelConstructor。 (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:826:38)       在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)       在g(events.js:175:14)       在EventEmitter.emit(events.js:106:17)       在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       在MongoReply.parseBody(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:132:5)       在null。 (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:410:22)       在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)       在EventEmitter.emit(events.js:98:17)       在Socket。 (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection.js:382:22)       在Socket.EventEmitter.emit(events.js:95:17)       在Socket。 (_stream_readable.js:699:14)       在Socket.EventEmitter.emit(events.js:92:17)       在emitReadable_(_stream_readable.js:382:10)       在emitReadable(_stream_readable.js:377:5)       在readableAddChunk(_stream_readable.js:142:7)       在Socket.Readable.push(_stream_readable.js:112:10)       在TCP.onread(net.js:511:21)

版本:

  • nodejs:0.10.1
  • compoundjs:1.1.5-21
  • jubblingdb:0.2.0-27
  • jugglingdb-mongodb:0.0.4-1

1 个答案:

答案 0 :(得分:0)

问题是jubblingdb 0.2.0-27上的一个错误。作者将其更新为0.2.0-28并解决了问题。