[MongoDB] 如何搜尋特定開頭的資料
範例
利用 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
https://stackoverflow.com/questions/53469514/mongodb-regex-string-startswith-and-endswith
留言
張貼留言