gpt4 book ai didi

javascript - Sails.js 水线破坏 "lower or equal"标准

转载 作者:搜寻专家 更新时间:2023-11-01 00:41:17 25 4
gpt4 key购买 nike

我试图在请求中使用 destroy 方法,但我无法让它工作。

不过,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.

这是我数据库中第一个请求返回的内容:

[ { 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' } ]

我哪里错了吗?我该怎么办?

谢谢。

最佳答案

    Cars.find({userId: params.userId, accessDate: { '<=': new Date() }})
.exec(function (err, found) {

});

Cars.destroy({userId: params.userId, accessDate: { '<=': new Date() }})
.exec(function (err) {

});

希望有帮助

关于javascript - Sails.js 水线破坏 "lower or equal"标准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33664119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com