如何創建not contains
查詢,如果該項目不包含特定值,則返回true。如果它是相關的,我正在運行mongoDB。SailsJS Waterline中的「不包含」查詢
我可以成功使用contains
但是當我引入not
時會收到錯誤。我用find
和where
試過了,但兩次都得到相同的正則表達式錯誤。如果其相關,我可以添加確切的錯誤。
工作版本:
model.find({attribute: {'contains': value}})
.exec(function(err, users) {
// happy code
});
下面抱怨一些正則表達式的錯誤:
model.find({attribute: {not: {'contains': value}}})
.exec(function(err, users) {
// sad code
});
存在這樣的問題,並提出了在2013年關閉這個問題。也許最近有什麼變化? https://github.com/balderdashy/waterline/issues/22
您是否嘗試過不引用? {not:{contains:value}} – jaumard 2015-03-31 07:05:55
老實說,我試過給'not'添加引號,並嘗試了'Not',但是我從來沒有想過修改'contains',因爲它自己工作。我會在早上 – 2015-03-31 07:07:42