1
考慮發票收集與下列文件:MongoDB中的文檔的2場之間的比較
{ "invoice_no" : "1001", "payable_amount" : 100, "paid_amount" : 50 }
{ "invoice_no" : "1002", "payable_amount" : 200, "paid_amount" : 200 }
{ "invoice_no" : "1003", "payable_amount" : 300, "paid_amount" : 150 }
{ "invoice_no" : "1004", "payable_amount" : 400, "paid_amount" : 400 }
需要這些文件,其中payable_amount> paid_amount
預期結果:
{ "invoice_no" : "1001", "payable_amount" : 100, "paid_amount" : 50 }
{ "invoice_no" : "1003", "payable_amount" : 300, "paid_amount" : 150 }
可以請你看看這個,https://stackoverflow.com/questions/8433046/mongodb-query -with-the-the-the-documents –