Skip to content

Nested query not working #1365

@Gyurmatag

Description

@Gyurmatag

I want to filter for the nationalities in the "launches" query like this:

{
    query: nationality ? { "payloads.nationalities": nationality } : {},
     options: {
         sort: { "date_utc": "desc" },
         page,
         limit,
        populate: ["payloads"],
      },
},

But this gives me no items back... There is a 2 year old issue where others also couldn't solve this.
Probably this might be a bug inside the backend, maybe here:

// Query launches
router.post('/query', cache(20), async (ctx) => {
  const { query = {}, options = {} } = await transformQuery(ctx.request.body);
  try {
    const result = await Launch.paginate(query, options);
    ctx.status = 200;
    ctx.body = await transformResponse(result);
  } catch (error) {
    ctx.throw(400, error.message);
  }
});

or somewhere in the _transform-query.js file

Does anybody has any idea on this? How we can solve it?

Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions