Open capcaicah opened 2 years ago
Please create an exact repro code on repl.it.
hi @icebob this is th repl.it:
I mean a working example that works on repl.it without transporter and MySQL (use sqlite)
Work with the _id field.
@aheadrox What do you mean here exactly? I'm facing to same issue, using postgresql with this settings in the service
// membership.service
...
settings: {
fields: ["id", "role", "userId", "communityId", "user"],
populates: {
"user": {
field: "userId",
action: "users.get",
params: {
fields: ["id", "name", "email", "avatar"]
}
}
}
}
...
when calling it I have this piece of code
return ctx.call('membership.find', {
query: {
communityId
},
populate: ["user"]
});
@icebob I confirm this issue as stated in my previous comment
What I find weird is that when I remove the query
section and only let populate
in the call args it seems working. but when a query is added into the args the populate doesn't work
With query
mol $ call membership.find '{"populate":["user"], "query": {"communityId": 1}}'
>> Call 'membership.find' with params: { populate: [ 'user' ], query: { communityId: 1 } }
>> Execution time:18ms
>> Response:
[
{
id: 1,
userId: 4,
communityId: 1,
role: 'citizen',
}
]
Without query
mol $ call membership.find '{"populate":["user"]}'
>> Call 'membership.find' with params: { populate: [ 'user' ] }
>> Execution time:2ms
>> Response:
[
{
id: 1,
userId: 4,
communityId: 1,
role: 'citizen',
user: {
id: 4,
name: 'Tester',
email: 'user@email.co',
surname: null,
avatar: null,
}
},
{
id: 2,
userId: 1,
communityId: 2,
role: 'citizen',
user: {
...
And this only works for find
method, not working on list
and get
neither
Any idea?
I need a repro example (without any external tools and schemas) what I can debug to investigate the problem.
I think you can use the replit you setup, just need to define 2 different service which are related My setup contains something else that are not really involved in this issue
@icebob here is a full reproduction https://replit.com/@irzhywau/issue-296
you can run npm run dev
to run it
Im still wondering what Im doing wrong, either the library is buggy
@irzhywau tested your repro and, after setting the userId@memberships.db
to same value as _id@users.db
, got the same result with both call membership.find '{"populate":["user"], "query": {"communityId": 1}}'
and call membership.find '{"populate":["user"]}'
It seems that user
field was properly populated, right? Can you please provide more info about the issue that you're facing?
HI, i try use populate to connect my detail to my master, but our populate not display. maybe can you help me
this is my code:
user_detail.js
user.js
index.js