How can I make that if roles column has client array in a document?

The way write the code is slightly different since this is also meteor.js and meteor.js uses mongodb.

I was able to get the User document with this code


also Users document looks like this.

  "_id" : "123sdasdasd",
  "createdAt" : ISODate("2022-06-15T20:36:01.549+0000"),
  "archived" : false,
  "roles" : {
      "internal" : [
      "client" : [
      "other" : [
  "username" : ""

My goal here is to make sure if this user has a roles column with client .

I believe this is on the server side but part of my code looks like this.

Roles.removeUsers = (userId, groupName) => {

  console.log(Users.findOne(userId)); // got document successfully 
  console.log(Users.findOne(userId).roles[groupName]); // got undefined

  if (Users.findOne(userId).roles[groupName].length < 1) {
    sampledataUpdate.$pull.userIds = userId;

The groupName could be internal , client , other or other strings.

Currently, I’m getting groupName as client .

How can I make sure if this user has client in roles column?

also another little question is if you look at the data structure above,

can I say roles as column ?

_id , createdAt , archived are column ?

and inside of column(roles for this case), what is the right word to describe internal , client or other ? Would that be key ?

Thank you!