Day 95 - BEGIN Shawshank Redemption, another query population hurdle


If you have seen any trailer of The Circle (2017), you will know that this is the thing that Emma Watson’s character is most scared of. I just finished watching Good Will (Goodwill?) Hunting. That movie is the portrayal of unfulfilled potential. The ending is good, in my opinion though, the movie is over rated generally.

I have gone through 2 pages of Rita Hayworth and Shawshank Redemption. It’s pretty easy reading (after that nightmarish historical mystery book, I bet anything with actual people walking around the place would be easy reading) and I know who Andy Dufresne is. Fair enough, more updates soon.

I went back and had a look at the “Should we send a notification?” flow chart that was recently tweeted by someone at Slack. It was a quip at how people say that “They could build X on a weekend”, X being anything like Facebook, Twitter, Slack etc. i.e. Deceptively simple products that have had a lot of thought put into their design, but no one acknowledges them. Worst of all, even other engineers don’t.

Another query population hurdle that I ran into was the population of an array of Strings, which are a unique field in another collection. Let me explain:

Person: {
  username: {
    type: String,
    unique: true,
    required: true

Comment: { ...
  usernames: {
    type: [String]

I have read the mongoose query population document several times but this particular case it seems hasn’t been addressed. If it were an array of ObjectIds, of course it would be a simple populate('usernames') addition to the query.

Virtuals was something that I tried to look into but that again serves another purpose altogether. I will keep looking but I think mongoose doesn’t support something like this right now.

POST #95 is OVER