We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe.
How to use builder.Lookup with SimpleAggregate?
builder.Lookup
SimpleAggregate
Describe the solution you'd like
Please add one more example using SimpleAggregate with builder.Lookup into https://github.com/Kamva/mgm/blob/master/examples/aggregate/aggregate.go
Describe alternatives you've considered Additional context
I tried it myself, adding the following to the top of func lookup(), after:
mgm/examples/aggregate/aggregate.go
Lines 24 to 27 in aff6e8d
{ authorCollName := mgm.Coll(&author{}).Name() result := []book2{} _ := mgm.Coll(&book{}).SimpleAggregate(&result, builder.Lookup(authorCollName, "auth_id", "_id", "author")) fmt.Printf("1] %+v\n", result) }
after defining book2 as:
book2
type book2 struct { book author []author }
However, what get printed was:
1] [{book:{DefaultModel:{IDField:{ID:ObjectID("000000000000000000000000")} DateFields:{CreatedAt:0001-01-01 00:00:00 +0000 UTC UpdatedAt:0001-01-01 00:00:00 +0000 UTC}} Name: Pages:0 AuthorID:ObjectID("000000000000000000000000")} author:[]}]
I.e., the lookup field author was empty, and so is the returned book, but the SimpleAggregate didn't return any error (I checked).
author
Please help.
The text was updated successfully, but these errors were encountered:
mehran-prs
No branches or pull requests
Is your feature request related to a problem? Please describe.
How to use
builder.Lookup
withSimpleAggregate
?Describe the solution you'd like
Please add one more example using SimpleAggregate with
builder.Lookup
intohttps://github.com/Kamva/mgm/blob/master/examples/aggregate/aggregate.go
Describe alternatives you've considered
Additional context
I tried it myself, adding the following to the top of func lookup(), after:
mgm/examples/aggregate/aggregate.go
Lines 24 to 27 in aff6e8d
after defining
book2
as:However, what get printed was:
1] [{book:{DefaultModel:{IDField:{ID:ObjectID("000000000000000000000000")} DateFields:{CreatedAt:0001-01-01 00:00:00 +0000 UTC UpdatedAt:0001-01-01 00:00:00 +0000 UTC}} Name: Pages:0 AuthorID:ObjectID("000000000000000000000000")} author:[]}]
I.e., the lookup field
author
was empty, and so is the returned book, but theSimpleAggregate
didn't return any error (I checked).Please help.
The text was updated successfully, but these errors were encountered: