Hi,
I am trying to do pagination with c# Mongodb driver. I have a collection called “Account”, from which I am doing lookup to “Contact”. I am having my pipeline stages. when I load the pipeline with appendstage one by one (like below)
_context.Aggregate().AppendStage<dynamic>(pipeline1).AppendStage(pipeline2).ToList();
it returns the value like this (which is Ok as I want it):
["data" : [ { "Account":{account_obj}, "Contact": {contact_obj} },
{ "Account":{account_obj_2}, "Contact": {contact_obj_2} }],
"count" : []
]
but when I load all pipelines at once like below:
_context.Aggregate<dynamic>(pipelines).ToList();
The value returned turns out to be different like below:
["data" : [ { "Account":{account_obj}},
{ "Account":{account_obj_2} }],
"count" : [],
"Contact": null
]
like you see the Contact lookup value is coming out of data.
Why is that ? What am I missing here? Any help would be much appreciated. Thanks.