Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

dbContext.DBSet.FirstOrDefault(e => e.FirstName == "xx") missing filter in MongoQueryable #32

@IvanZheng

Description

@IvanZheng

zooDbContext.Employees .FirstOrDefault(e => e.FirstName == "xx") will retrieve all records from employees collection in mongodb.

Reproduce step:

  1. Open mongo shell and use the command "db.setProfilingLevel(2)" to open the query profiler.
  2. Execute zooDbContext.Employees .FirstOrDefault(e => e.FirstName == "xx") in test case.
  3. Use db.system.profile.find().sort({$natural:-1}) to view the profiler data.
    From the profiler data, we can see there is no filter or pipeline in the command.

`

{
"op" : "command",
"ns" : "zooDb.employees",
"command" : {
    "aggregate" : "employees",
    "pipeline" : [],
    "cursor" : {},
    "$db" : "zooDb",
    "lsid" : {
        "id" : UUID("5854cdca-ee1e-44d2-8098-5d1ae3ed06a3")
    }
},
"keysExamined" : 0,
"docsExamined" : 2,
"cursorExhausted" : true,
"numYield" : 0,
"locks" : {
    "Global" : {
        "acquireCount" : {
            "r" : NumberLong(4)
        }
    },
    "Database" : {
        "acquireCount" : {
            "r" : NumberLong(2)
        }
    },
    "Collection" : {
        "acquireCount" : {
            "r" : NumberLong(2)
        }
    }
},
"nreturned" : 2,
"responseLength" : 422,
"protocol" : "op_msg",
"millis" : 0,
"planSummary" : "COLLSCAN",
"ts" : ISODate("2018-12-11T09:05:25.129Z"),
"client" : "127.0.0.1",
"allUsers" : [],
"user" : ""

}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions