[英]Sails ORM: How to know if found or Created in findOrCreate waterline function
[英]sails Sorry, this function doesn't know how to handle {…} callbacks
不知何故,我的sails.js 1.x环境已经变得混乱到无法再对PostgreSQL数据库执行本地查询的地步。 我确定问题是某个软件包或另一个软件包的版本,因为我在周末对NodeJS 9进行了一些试验,但是这段代码在星期五工作,所以看不到问题所在。 有什么建议么?
sails> sails.getDatastore().sendNativeQuery('SELECT COUNT(*) FROM "user"').then(console.log);
Promise {
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined }
sails> UsageError: Sorry, this function doesn't know how to handle {...} callbacks.
If provided, the 2nd argument should be a function like `function(err,result){...}`
| If you passed in {...} on purpose as a "switchback" (dictionary of callbacks),
| please be aware that, as of machine v15, you can no longer pass in a switchback
| as the 2nd argument. And you can't pass a switchback in to .exec() anymore either.
| Instead, you'll need to explicitly call .switch().
[?] See https://sailsjs.com/support for help.
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:133:24
at _makeCallToDuringFn (/Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:101:28)
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:103:7
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:66:14
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/node_modules/machine/lib/private/help-build-machine.js:966:24
at Function.handlerCbs.success (/Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/node_modules/machine/lib/private/help-build-machine.js:826:26)
at cb (/Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/machines/get-connection.js:87:20)
at BoundPool.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg-pool/index.js:137:9)
at bound (domain.js:301:14)
at runBound (domain.js:314:12)
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/generic-pool/lib/generic-pool.js:347:9
at BoundPool.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg-pool/index.js:103:7)
at Connection.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg/lib/client.js:158:7)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:121:20)
at Connection.emit (events.js:211:7)
at Socket.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg/lib/connection.js:121:12)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20)
sails>
任何提示或想法将不胜感激。
原来这是我们运行的Sails版本中的错误。 我将风帆升级到1.0.2,并解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.