为使用 Postgres 的任何人添加此答案。我正在尝试这个并将我的头撞在墙上,因为它不起作用,我不知道为什么。我到处搜索并不断找到这个答案。
如果你在 postgres 你想使用
id: { not: req.params.id }
在查看 Sailsjs 文档并在谷歌上长时间地搜索后,我在sails-postgresql 模块 query.js 的 cmets 中找到了这个答案。希望这有助于在一段时间内拯救处于相同情况的人。这是完整的评论块,让我保持清醒。
/**
* Specifiy a `where` condition
*
* `Where` conditions may use key/value model attributes for simple query
* look ups as well as more complex conditions.
*
* The following conditions are supported along with simple criteria:
*
* Conditions:
* [And, Or, Like, Not]
*
* Criteria Operators:
* [<, <=, >, >=, !]
*
* Criteria Helpers:
* [lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual, not, like, contains, startsWith, endsWith]
*
* ####Example
*
* where: {
* name: 'foo',
* age: {
* '>': 25
* },
* like: {
* name: '%foo%'
* },
* or: [
* { like: { foo: '%foo%' } },
* { like: { bar: '%bar%' } }
* ],
* name: [ 'foo', 'bar;, 'baz' ],
* age: {
* not: 40
* }
* }
*/