1
における文書の2つのフィールド間の比較:は、次の書類を請求書のコレクションを考えてみましょうMongoDBの
{ "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-fields-with-same-documents –