Since this explores the problem, when we need to compare two fields from the same document, find the fragment that uses the aggregation structure.
the Datapull class received an additional field for this:
public bool IsTrue { get; set; }
A fragment of the C # aggregation structure below
var data = collection.Aggregate(); var a1 = data.Project( x => new { FSTicker = x.FSTicker, Sedol = x.Sedol, Company = x.Company, Exchange = x.Exchange, LocalTicker = x.LocalTicker, IsTrue = (x.Sedol == x.FSTicker) }); var a2 = a1.Match(x => x.IsTrue); var result = a2.ToList();
EDIT
the problem here is based on the fact that the mongo himself does not have a method for comparing fields on the same documents, which are something natural for peoples coming from the SQL world.
Mongo has a $where clause - this is javascript injection, and we can pass such a fragment to work with each returned document from our dataset, but the linq query is not used for use.
Here is a JIRA ticket: jira
EDIT 2
Please download the example from the repo - maybe something is missing. Below is a screenshot of the working solution.
Git repo here

Any comments are welcome!
source share