2016-12-31 38 views
0
select * 
from job 
where 
    (title LIKE %xxx% OR dsc LIKE %xxx% OR requirements LIKE %xxx%) 
    AND 
    (country LIKE %xxx%) 

如何在MongoDB中執行此操作?

+0

就是你們的榜樣SQL?你應該編輯你的帖子來說明它是什麼。你還試過了什麼,你得到了什麼錯誤? – Aaron

回答

1

使用本:

db.job.find({ 
    $and : [ 
     {$or : [ 
      {title : \xxx\}, 
      {dsc : \xxx\}, 
      {requirements : \xxx\} 
     ]}, 
     {country : \xxx\} 
    ] 
}) 
+0

感謝Mohsen它的工作...是的我的例子是SQL ..需要MongoDB查詢幫助。 –