MongoDB to find in array by array with Go

36 Views Asked by At

Sorry for this very noob question -- in MongoDB I have this array field, and from http I'm getting an array of values, to match any of the array-field values. How to do it in Go please?

By reading doc here, I managed to create a sample MongoDB find query: https://mongoplayground.net/p/6cP3NWV0OUg

However, the challenge to me is

  1. how to translate it into Go, and
  2. how to make it dynamic, based on the input array of values, as the above sample query can only handle two values, whereas the actual input element can range from one to many.

Or, maybe there is a better way than my above sample query?

0

There are 0 best solutions below