Query result is not correct
See original GitHub issue[Fact]
public async Task Test()
{
// count is 20
var all = await DB.Find<CNCPartCost>().Match(it=>true).ExecuteAsync();
// count is 1
var filterRes= all.Where(pc =>
pc.Steps.Count > 0 && pc.Steps.First(s => s.Status == CNCPartCostStatus.Quoted).Time != null).ToList();
// count is 0
var res =await DB.Find<CNCPartCost>().Match(pc =>
pc.Steps.Count > 0 && pc.Steps.First(s => s.Status == CNCPartCostStatus.Quoted).Time != null)
.ExecuteAsync();
// count is 0
var res2=DB.Collection<CNCPartCost>().Database.GetCollection<CNCPartCost>("cncPartCosts").AsQueryable().Where(pc =>
pc.Steps.Count > 0 && pc.Steps.First(s => s.Status == CNCPartCostStatus.Quoted).Time != null).ToList();
}
Under normal circumstances, the results of filterRes
、res
、res2
should both be 1,and when i check the query log from mongo,i get this:
I found that the converted pipeline code is not consistent with my linq code,did I do something wrong?
one data that should be returned:
Issue Analytics
- State:
- Created a year ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
SQL query giving incorrect results
(In short, the query isn't wrong, the data in that table simply isn't what you think it is / want it to be.)...
Read more >How to troubleshoot incorrect query results
Answer: · Ensure you are using the correct query and/or query type: Verify you are using the correct saved query. · Ensure the...
Read more >Query results isn't working - Is it my code incorrect or is it ...
Hi there,. My code for the first project on SQL (create a table) isn't querying any results. It does show results after the...
Read more >MySql NOT IN query gives wrong results
I have a simple database that I want to use to do some data analysis. My original data was in excel documents so,...
Read more >Select Query not returning correct results
I have an SQL statement which is below. The problem with this statement is when I run it the query returns zero records....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wow, very nice solution! thank you very much for your help! I will take the time to read the relevant information
Yes, if I find that the result is the same after the upgrade, I will write a minimal reproducible sample code and submit it