For example, I'm just trying to order a users feed...
# orm-help
e
For example, I'm just trying to order a users feed by creation date of posts:
Copy code
feed: async (_, { id }, ctx, info) => {
    const following = await ctx.prisma.user({ id }, info).following();
    const followingIds = following.map(follower => follower.id);

    return ctx.prisma.posts(
      {
        where: {
          author: { id_in: [...followingIds, ctx.request.userId] }
        },
        orderBy: "createdAt_ASC",
      },
      info
    );
  },
s
In what order do you get your results after running this query currently?
e
I get the most recent post first
If i remove the
where
and just have the
orderBy
it works as expected when switching between
createdAt_ASC
and
createdAt_DESC
So I must be combining the two wrong maybe 🤔
s
Yeah looks like it
What version of prisma do you currently use?
e
"prisma-client-lib": "1.28.3"
👍 1
And using the mongo connector