Tag: NoSQL
-
Tracking daily active users (DAU) with Redis
Daily active users, also known as DAU, is the number of unique users that have interacted with a website or application in a given day. We’re going to discuss how to track this metric, in a language agnostic fashion. The concepts discussed and Redis commands utilized can be implemented in…
-
How to set Redis max memory usage
Redis is one of my favorite data stores. The multitude of data types makes it flexible enough to serve as a simple caching layer (replacing Memcached) or as a full-blown RDBMS replacement if you’re willing to jump through a few hoops. Because Redis is an in-memory data store, it’s limited…
-
How to get the first and last item from an array in MongoDB
One of the great features of MongoDB is the ability to store an array in a document. While I’m fully aware that there are issues with storing unbounded arrays in MongoDB, due to document size limitations, there are times when you may want to store data in an array that…
-
Unique indexes with MongoDB and Mongoose
Even though I’ve been using MongoDB for the last few years, I’m still very much a noob when it comes to a lot of things. One of those things would be unique indexes. Generally speak, I interact with MongoDB three different ways: I write code that explicitly creates something with…
-
React Draft Wysiwyg with MongoDB
We love open source software here at CrowdSync. Sometimes though, we run into issues with the software we’ve deemed as the “right” package for us. A recent incident has been with React Draft Wysiwyg which we decided to use as part of our action to compose and send emails to…
-
Convert Mongo BSONDocument to an array in PHP
Ran into a scenario this weekend where I needed to take a sub-document from Mongo but I needed it in an array in PHP. Reading the data from Mongo with PHP was simple and won’t be discussed. What I’d like to talk about is taking the BSONDocument that Mongo returns…
-
Tracking peak users online with Redis
This probably isn’t the best way to track things, but it’s the best I came up with. Tracking the total number of users that log in per day or month is trivial as I have discussed in a previous post. To track the peak users online at a given time…
-
Bitmaps vs. Sets to track Monthly Active Users in Redis
Recently I was building a piece of functionality to track the daily and monthly active users on one of my sites. I already track this data in MySQL but retrieving the data was sluggish, even after creating a few new indexes, so I decided that I would use Redis. The…
-
How to connect to MongoDB using PHP
I’ve previously discussed installing the MongoDB module but have yet to touch on how to actually do anything past the install. The first thing to do is to connect to the MongoDB server. This can simply be done like this: $client = new MongoClient(); This will connect to the default…
-
Stop Accommodating Shortcomings
I came to a very liberating conclusion the other day. I need to stop fucking around with MySQL, or any other RDBMS, and fully embrace a NoSQL server as my primary data store. I’ve been a huge fan of Redis for quite some time but the fact that everything lives…