0

I have a list of MongoDB _ids that correspond to their appropriate documents. Is there a way to write a graphQL query that will return a corresponding list of documents in the same order as their mongoDB _ids?

I know you can do filter{ _ids: $listOfIDs } to get a payload, but the payload does not have the order that corresponds to the order of the list of _ids.

  • Does this help: https://stackoverflow.com/questions/58976826/how-to-implement-graphql-scalar-for-mongodb-sort-property-found-in-collection-fi – Joe Sep 01 '20 at 04:38
  • hmmm I don't think so because it deals with the sorting using mongoDB in the back-end I believe, not with the sorting being done at the query – Brandon Zhang Sep 01 '20 at 04:51
  • 1
    filtering is implementation dependent ... resolver is the place when you can try to implement you required logic – xadm Sep 01 '20 at 07:12

0 Answers0