I have two different collections with a common field, like UserId. There are other attributes that qualify UserIds.
Example:
Collection 1: {UserId, SellsToUserId}
Collection 2: {UserId, BuysFromUserId}
I want to start an operation that gives me the difference between two sets.
Sample request: Get all user IDs that this UserId sells but does not buy.
Pseudo code solution
var sellToCursor = collection1.Find(Query.EQ("UserId", Me)).SetFields({SellsToUserId}); var buyFromCursor = collection2.Find(Query.EQ("UserId", Me)).SetFields({BuysFromUserId}); SellToButDontBuyFrom[] = sellTo - buyFrom;
I want to do this on a MongoDB server because I have large data arrays.
Any suggestions for effective use?
source share