我使用 Data
连接系统在 Sails 中有一个 sails-cassandra
模型。数据。 Data.count({...}).exec()
返回 1,但 Data.find({...}).exec()
或 Data.findOne({...}).exec()
返回以下错误消息:
Error (E_UNKNOWN) :: Encountered an unexpected error
ResponseError: Undefined name folder in selection clause
at FrameReader.readError (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/readers.js:276:13)
at Parser.parseError (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:187:45)
at Parser.parseBody (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:169:19)
at Parser._transform (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:103:10)
at Parser.Transform._read (_stream_transform.js:179:10)
at Parser.Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:288:5)
at Parser.Writable.write (_stream_writable.js:217:11)
at Protocol.ondata (_stream_readable.js:540:20)
at Protocol.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Protocol.Readable.push (_stream_readable.js:126:10)
at Protocol.Transform.push (_stream_transform.js:140:32)
at Protocol.transformChunk (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:75:8)
at Protocol._transform (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:26:10)
at Protocol.Transform._read (_stream_transform.js:179:10)
at Protocol.Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:288:5)
at Protocol.Writable.write (_stream_writable.js:217:11)
at Socket.ondata (_stream_readable.js:540:20)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
(event loop)
at RequestHandler.send (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/request-handler.js:128:11)
at Client._getPrepared (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/client.js:581:11)
at /Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/client.js:399:12
at fn (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/async/lib/async.js:638:34)
at Immediate._onImmediate (/Users/samuel/Apps/dataapp/node_modules/sails-cassandra/node_modules/async/lib/async.js:554:34)
at processImmediate [as _immediateCallback] (timers.js:367:17)
最佳答案
这可能是构造返回属性的一个问题,因为 count()
不返回任何属性,而 find()
和 findOne()
会。
我会看看你模型的属性。添加和删除每一个,直到找到罪犯。
关于node.js - Cassandra Sails model.count() 有效,但 model.find() 和 model.findOne() 无效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33084155/