In our Mongo database, we have a collection indexed by "StoreId" and "ItemId". The following query returns all combinations of merchandise stores (total 9 documents) included in list "B".
var productQuery = Query.In("ItemId", new BsonArray(new List<int> {1, 2, 3})); var storeQuery = Query.In("StoreId", new BsonArray(new List<int> {1, 2, 3})); var queryToBringNineDocuments = Query.And(productQuery, storeQuery);
How to write a query that returns documents with keys to the following list of element tuples?
var neededProductStores = new List<Tuple<int, int>> { new Tuple<int, int>(1, 2), new Tuple<int, int>(1, 3), new Tuple<int, int>(2, 1), new Tuple<int, int>(3, 2) }; var queryToBringFourDocuments = ?;
derdo source share