[MongoDB] 如何搜尋特定開頭的資料 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 2月 01, 2023 範例 利用 regex 搜尋 invoice_id 是 AR 開頭的 record: db.paymentRecords2.find({invoice_id:{$regex: /^AR/ }}).limit(10) 參考資料 https://stackoverflow.com/questions/53469514/mongodb-regex-string-startswith-and-endswith Read more »
[MongoDB] find 時只顯示出特定欄位 Return the Specified Fields when FIND() 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 1月 31, 2023 範例 只顯示 name 欄位: db.counters.find({},{"name":1}).limit(50).pretty() Read more »
[MongoDB] 統計各 product_line 的資料數量 (select count(id), product_line from invoiceRequests group by product_line) 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 1月 15, 2023 Sample: 統計各 product_line 的資料數量 db . invoiceRequests . aggregate ([ { $ group : { _id : "$ product_line ", count : { $ sum : 1 } } } ]) Read more »