Zaid-Ajaj / LiteDB.FSharp

Advanced F# Support for LiteDB, an embedded NoSql database for .NET with type-safe query expression through F# quotations
MIT License
180 stars 22 forks source link

when querying without `include` DBRef idenetity is always resolved as 0 #36

Closed humhei closed 5 years ago

humhei commented 5 years ago
     testCase "CLIType DBRef token without include Test" <| fun _ -> 
      useDatabase <| fun db ->
        let company = {Id = 1; Name = "InitializedCompanyName"}  
        let order = { Id = 1; Company = company; EOrders = []}
        db.Insert(company)
        db.Insert(order)
        let m = db.Query<Order>().FirstOrDefault()
        Expect.equal m.Company.Id 1 "CLIType DBRef token without include Test corrently"   

this tests is failed while below test with Include(convertExpr <@ fun c -> c.Company @> is passed

    testCase "CLIType DBRef NestedId token Test" <| fun _ -> 
      useDatabase <| fun db ->
        let company = {Id = 1; Name = "InitializedCompanyName"}  
        let order = { Id = 1; Company = company; EOrders = []}
        db.Insert(company)
        db.Insert(order)
        let m = db.Query<Order>().Include(convertExpr <@ fun c -> c.Company @> ).FirstOrDefault()
        Expect.equal m.Company.Id 1 "CLIType DBRef NestedId token Test Corrently"