繁体   English   中英

Sails.js水线破坏“降低或相等”标准

[英]Sails.js waterline destroy “lower or equal” criteria

我正在尝试以低于请求的方式使用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) {

    });

希望对大家有帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM