簡體   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