![](/img/trans.png)
[英]Waterline ORM (sails.js) conditions with NOT Equal in query
[英]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.