Document size limit 16 MB

I am trying to use a file of IDS that have above 10gb of ids. I want to load those 10gb in ram and make a list of ids then use that list to exclude those ids in a query. The problem is I get an mongo error because the maximun size of BSON can not exceed 16MB. there is a way to solve this problem?