question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 filterResresres2 should both be 1,and when i check the query log from mongo,i get this:

image

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:

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
li-zheng-haocommented, Oct 21, 2022

Wow, very nice solution! thank you very much for your help! I will take the time to read the relevant information

1reaction
li-zheng-haocommented, Oct 21, 2022

if not solved in latest version, can you pls provide a repro that i can just copy/paste and debug?

Yes, if I find that the result is the same after the upgrade, I will write a minimal reproducible sample code and submit it

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found