avatar
How do I manage users with MongoDB shell?
by Sam Howell - Saturday, 23 October 2021, 10:29 AM
 

I want to find out where Adapt data is being stored, in case I need to manage this data, such as users, outside of the AAT UI.

After a fresh install, using the defaults and no db authentication, and adding an additional test user, I use mongo shell then show dbs and can verify my new adapt-tenant-master is there. However, this only seems to contain collections, no users. I use show users when using adapt-tenant-master and there's nothing.

I suspect I may be confusing terminology here. Does "users" in the mongo shell context refer to users in my adapt-tenant-master (Adapt users), or does it refer to MongoDB users?

I noticed that despite my fresh install assuming the default data directory to use exists at /data, this doesn't actually exist. So where exactly is the AAT storing all the data if there's no /data directory and there's nothing in adapt-tenant-master?

I'm sure I'm missing something obvious, which I'm going to kick myself for later. I haven't had much luck learning more from the config docs here, so I'd appreciate any suggestions or resources for correctly configuring and managing MongoDB databases after a default install.

Thanks in advance.

AAT config

{
  "outputPlugin": "adapt",
  "dbType": "mongoose",
  "auth": "local",
  "root": "/home/admin/adapt_authoring",
  "sessionSecret": "995ee6c05ff9b91446adef511755ce98a79ad007fa12c56f084a9af6922c34b350ffea789a2959c1779e814ba9ce08b48ee1cd1ab871c99ee0965f2bce56af00",
  "serverPort": 5000,
  "serverName": "localhost",
  "dataRoot": "data",
  "authoringToolRepository": "https://github.com/adaptlearning/adapt_authoring.git",
  "frameworkRepository": "https://github.com/adaptlearning/adapt_framework.git",
  "frameworkRevision": "v4.5.0",
  "dbName": "adapt-tenant-master",
  "useConnectionUri": false,
  "dbHost": "localhost",
  "dbPort": 27017,
  "dbUser": "",
  "dbPass": "",
  "dbAuthSource": "",
  "useSmtp": false,
  "maxLoginAttempts": 20,
  "ckEditorExtraAllowedContent": "span(*)",
  "maxFileUploadSize": "200MB",
  "ckEditorEnterMode": "ENTER_P",
  "masterTenantName": "master",
  "masterTenantID": "61724bbd91d15259e11447df",
  "isProduction": true
}

mongo shell output

> show dbs
adapt-tenant-master     0.001GB
admin                   0.000GB
config                  0.000GB
local                   0.000GB

> show collections
articles
blocks
components
componenttypes
configs
contentobjects
courses
extensiontypes
menutypes
migrations
policies
roles
sessions
tenants
themetypes
users
>

> use adapt-tenant-master
switched to db adapt-tenant-master
> show users
>

> db.getUsers()
[ ]
>

> db.collections.users.stats()
{
    "ns" : "adapt-tenant-master.collections.users",
    "size" : 0,
    "count" : 0,
    "storageSize" : 0,
    "totalSize" : 0,
    "nindexes" : 0,
    "totalIndexSize" : 0,
    "indexSizes" : {
       
    },
    "scaleFactor" : 1,
    "ok" : 1
}
>