hi! sometimes when I do prisma.query.user({id}) .....
# orm-help
m
hi! sometimes when I do prisma.query.user({id}) .. and I console.log I only get the id back .. other times if graphql info parameter is passed like prisma.query.user({id}, id) .. I get the full JSON object
a
Because
info
contains the query that you are sending.
m
I am creating a "suggestedFollowers" kind of thing where I want to filter out the ones already being followed. How do I do this? 😞
c
basically you should use
prisma.query.user({ id }, info)
info
is the 4th parameter of the resolver.
m
Thanks so much!
Copy code
async suggestedRestaurants(parent, args, ctx: Context, info) {
		const { where: _where, ...restArgs } = args;
		const _id0 = getUserId(ctx);
		const user = await ctx.db.query.user({ where: { id: _id0 } });
		console.log('user.......', user.follows);
		const follows = user.follows || [];
		return ctx.db.query.restaurants({
			where: {
				id_not_in: follows.map((_a) => _a.id),
				..._where
			},
			...restArgs
		});
	}
I want to filter some results..
even when I am passing "info" I am not able to get back the follows node .. so I could filter them out later
guys I figured it out
you have to pass it like binding.query.users({},
{ id name }
)