Building a Slackbot 5: Starting and Finishing mongodb tutorial

Hey everyone!

It’s been quite a while since I’ve updated on the progress of the slackbot. I actually haven’t done any coding in the last few weeks, because I was working in Chiang Mai, Thailand with another job that I started (hopefully video about that coming soon!). And then back in Vietnam, I was doing some workshops at this summer camp in Long Xuyen. And then finally once I got back to Vung Tau, I of course had to get caught back up on work with The Lab.

So now that I had a few hours to get back into coding, I worked a little bit on a CS50 problem set (Game of Fifteen) and went through a mongoDB tutorial.

MongoDB is essentially a database system that works easily with javascript and really important for work with my slackbot, oombaw. For oombaw, users should be able to save their language preferences and vocab words to a list attached to them. From going through this tutorial, I realized that I probably just one to have one user object with a bunch of related properties. Maybe something like:


name: iampeternguyen,

slackTeam: ‘abcdef’,

nativeLanguage: [‘eng’],

learning: [‘es’, ‘vi’],

vocab: [

{ vi: ‘từ, es: ‘palabra’, en: ‘word’}



Then users could easily add words by pushing it to the vocab array. From the tutorial, I get the idea of how to

  1. Create a “schema” for my data
  2. Add and save it to the database
  3. Delete and update
  4. And nest data within data

Pic: Shows my tests running successfully after going through the mongodb tutorial!

But there’s one thing I haven’t quite wrapped my head around yet, and that is how to the database with work with multiple users. It would be one thing if there was only one list, but lists need to be tied to specific users. And if multiple teams are using this, then there’s also a chance that users will have the same username. From the tutorial, I saw things about uniqueIDs, but I’m not quite sure how to make sure that unique ID is tied to that slack user. So I guess that’s where I got to do some more reading.