0

I have an ordered array containing external user ids. I want to upload this array to a mongo aggregation pipeline, then iterate through every element and perform a query on each element by filtering where the document external user id equals the element. How do I do this.

Here is an example of some documents:

 {
     _id: 0ao8feub0aoleuc
     externalId: aaaaaaaa
 }

 {
     _id: 93084u98aoegu9
     externalId: bbbbbbb
 }

 {
     _id: fdhcfidgcfyid8
     externalId: ccccc
 }

I have an array, formed client side, that is [aaaaaaaa, ccccc]. I want to retrieve the documents with external Ids that match the array elements, but I want them to come back in the order of the array, so the order of the external ids are aaaaaaaa, ccccc.

The reason I want to do this is so I can then limit the number of documents returned.

God Himself
  • 209
  • 1
  • 4
  • 15

0 Answers0