0
我有以下SQL語句MongoDB的equivelant到SQL 「NOT LIKE」 查詢
SELECT Currency, TransTime, AuthTime FROM MONIES WHERE Currency not like 'USD%';
如果SQL語句是一個簡單的 「喜歡」 查詢時,它會產生以下的MongoDB聲明
db.MONIES.find({
"Currency": "USD%"
}, {
"Currency": 1,
"TransTime": 1,
"AuthTime": 1
});
這是否適用於「不相似」等效的查詢?我想這是每the documentation for the 'not' operator正確的,但我想用加倍#1
db.MONIES.find({
"Currency": { $not: { $like: 'USD%' } }
}, {
"Currency": 1,
"TransTime": 1,
"AuthTime": 1
});
沒有$ like操作符,我想你正在尋找正則表達式http://docs.mongodb.org/manual/reference/operator/query/regex/ –