2013-04-01 295 views
0

我使用複合mongodb創建應用程序。複合使用jugglingdb和jugglingdb-mongodb連接到mongodb。使用複合,我使用validatesPresenceOf時更新時出錯

我爲使用化合物腳手架的客戶端生成了垃圾郵件。然後,我添加Client.validatesPresenceOf('name');到應用程序/模型/ 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 throw err; ^ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (http.js:708:11) at ServerResponse.res.setHeader (/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 (/Users/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 eval (eval at (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17), :97:38) at Object.html (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/helpers.js:43:17) at eval (eval at (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17), :93:20) at 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) at 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 at 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) at 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) at Socket. (/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) at Socket. (_stream_readable.js:699:14) at 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
  • compoundjs:1.1.5-21
  • jubblingdb:0.2.0 -27
  • jugglingdb-mongodb:0.0.4-1

回答

0

問題是jubblingdb 0.2.0-27上的一個錯誤。作者將其更新至0.2.0-28,問題解決了。