[英]Sails.js waterline destroy “lower or equal” criteria
I'm trying to use the destroy
method with a lower than in the request, and I can't make it to work. 我正在尝试以低于请求的方式使用destroy
方法,但无法使其正常工作。
Although, the find
method returns some content with the exact same parameters. 虽然, find
方法返回的参数完全相同。
Cars.find({userId: params.userId, accessDate: { '<=': new Date() }}, function (err, found) {
console.log(found); //Returns an array with multiple entries.
});
Cars.destroy({userId: params.userId, accessDate: { '<=': new Date() }}); //Does nothing, the entries are not destroyed.
This is the content in my database returned by the first request: 这是我的数据库中第一个请求返回的内容:
[ { userId: '563c1c37be1ed48e7f8c6ada',
accessDate: '2015-11-07T21:36:13.169Z',
id: '563e60bd19667c52bd831182' },
{ userId: '563c1c37be1ed48e7f8c6ada',
accessDate: '2015-11-10T05:04:01.850Z',
id: '56416cb140112987ce6ec049' },
{ userId: '563c1c37be1ed48e7f8c6ada',
accessDate: '2015-11-12T03:59:36.519Z',
id: '5644009851503b42e589ecf1' } ]
Am I wrong somewhere? 我在某个地方错了吗? What should I do? 我该怎么办?
Thanks. 谢谢。
Cars.find({userId: params.userId, accessDate: { '<=': new Date() }})
.exec(function (err, found) {
});
Cars.destroy({userId: params.userId, accessDate: { '<=': new Date() }})
.exec(function (err) {
});
Hope helpful 希望对大家有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.