MongoDB提供了一個叫做$exists的操作符,可以用來檢查文檔中是否存在某個鍵。例如,要檢查文檔中是否存在名為“unknown_key”的鍵,可以使用以下查詢:
db.collection.find({ "unknown_key": { $exists: true } })
MongoDB提供了一個叫做$exists的操作符,可以用來檢查文檔中是否存在某個鍵。例如,要檢查文檔中是否存在名為“unknown_key”的鍵,可以使用以下查詢:
db.collection.find({ "unknown_key": { $exists: true } })
公眾號:1024技術圈
?? 提供互聯網知識和資訊,分享IT前沿技術,熱門資源,大廠面試題 ??