Given the collection "example":
{_id: 1, prediction: "H", result: "A"}
{_id: 2, prediction: "H", result: "H"}
{_id: 3, prediction: "A", result: "A"}
What do I need to do to find records where the prediction and result values match? ie. documents 2 and 3?
Finding all the "H" predictions is:
db.example.find( { prediction: "H" } )
But I need to replace the literal "H" with the value in the result field of the same document.
Edit: Sorry, I should have said that I was using Mongo 3.6.