grantRolesToUsers with ruby

Hi all,
Is there any way to run grantRolesToUsers like query through mongodb ruby driver?

This appears to be a cross post from https://stackoverflow.com/questions/63340548/grant-roles-to-mongo-users-via-rails which has already been answered (pasted below):


The Ruby mechanism for running arbitrary commands is documented here.

You would then do something like:

 client.database.command(grantRolesToUser: username, roles: ['foo'])

To get the client instance, use Foo.collection.client where Foo is a Mongoid model class.