[MongoDB] 如何搜尋帶有某 key 的資料 / 如何搜尋某 key 下帶有非 null value的資料

1. 搜尋帶有 foo 這個 key 的資料:

db.mycollection.find({"foo":{$exists:true}});

2. 搜尋 foo 這個 key 帶有值(!=null)的資料:
db.mycollection.find({"foo":{$ne:null}});

留言

這個網誌中的熱門文章

ISC2 CC (Certified in Cybersecurity Certification) 考試心得

Salesforce證照考試心得 (Administrator and Advanced Administrator)