Database

db={"user":[{"id":1,"category":"VIP","area":"XXX"},{"id":2,"category":"VIP","area":"YYY"}],"history":[{"userId":1,"usage":26,"balance":99},{"userId":1,"usage":24,"balance":101}]}

Query

db.user.aggregate([{"$lookup":{"from":"history","localField":"id","foreignField":"userId","as":"history"}},{"$match":{"category":"VIP","area":"XXX","history.usage":{"$gt":25},"history.balance":{"$lt":100}}},{"$project":{"id":1}}])

Result