Try:
db.XXX.find({ "_id.module" : "B" });
The difference is your original query would be trying to match on that entire subdocument (i.e. where _id is a subdocument containing a “module” field with value “B” and nothing else)
Reference: MongoDB Dot Notation