Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Convert query to mongodb on Java

I have a simple document in momgo with name User. In this document i have a field(userRoles), which contains user roles, it's array(like ["ADMIN", "SUPER_ADMIN", "USER"]).

I'm using mongo compas, and I have created simple request with filter to find some users:

db.getCollection('user').find({userRoles: {$elemMatch: {$in: ["ADMIN", "SUPER_ADMIN"]}}})

How can I do it on Java?

Comments