MongoDB

hingo's picture

Moving to MongoDB Engineering

It will soon be 3 years that I've been with MongoDB. I joined the company amidst a strong growth spurt, and 5 months later the HR website told me that I had now been in the company longer than 50% of my colleagues.

hingo's picture

4 modifications for Raft consensus

A month ago I published a quasi-academic paper, proposing 3 modifications to the Raft replication algorithm. I got some great review and feedback on the Raft mailing list. So based on that I have now updated the paper, hopefully to be much clearer than the first iteration.

hingo's picture

3 modifications to the Raft consensus algorithm (paper)

Update: This version of my paper is superceded by a new version: 4 modifications to Raft consensus. Please read it instead.

August is usually a slower month as a lot of people are on vacations. I try to take advantage of that to work on tasks that require a bit more deliberation and quiet time. This Summer I returned to re-reading the paper on the Raft algorithm, in particular my colleagues in New York pointed out that the PhD thesis that extends on the original paper was now complete, and contains some additional details.

hingo's picture

A MEAN Hackathon

I'm preparing to do some simple MongoDB hackathons in Scandinavia, and because I don't want to forget how to do all the steps, I actually wrote down an example exercise.

This is a simple and fun exercise just to get some data into MongoDB and then get it out again. We're going to use some awesome JavaScript tools for the out part: Node.js and Crest for a simple HTTP API, and Angular.js to draw the pretty pictures. So this is not just a MongoDB hackathon but more like a fullstack JavaScript or MEAN hackathon. (Strictly speaking there's no Express.js, so maybe this is a NMCA hackathon?)

Install MongoDB

The usual apt, yum and brew methods will work for this tutorial.

hingo's picture

5 MongoDB features that are NOT reasons to choose MongoDB

On May 5th I will be speaking at the ICT Expo in Helsinki. On home field, so to speak! This is the major Finnish ICT event and MongoDB will be exhibiting together with our Nordics partner Altotech.

The title for my talk is "5 Reasons that made MongoDB the Leading NoSQL Database". In preparing the talk I came to think of several MongoDB features that are great, but in consideration are clearly NOT reasons that make MongoDB stand out against other NoSQL databases.

Why? Because these are typical traits of any NoSQL database. Here's my Top 5 list of non-reasons:

hingo's picture

MongoDB Aggregation Framework fun: the answer

Last week I posted a challenge about ordering fabric for a bunch of different flags, which can be conveniently solved with the MongoDB aggregation framework. Did you figure out the answer?

So we have a bunch of these flag orders for different countries:

{
	"_id" : ObjectId("52a71923cd4dd732cd060204"),
	"country" : "Norway",
	"colors" : [
		{
			"color" : "red",
			"fabric_units" : 3
		},
		{
			"color" : "blue",
			"fabric_units" : 2
		},
		{
			"color" : "white",
			"fabric_units" : 1
		}
	],
	"num_flags" : 2
}

And to calculate how much fabric we need of each color:

> db.flags.aggregate( [ 
    { $unwind : "$colors" },
hingo's picture

MongoDB Aggregation Framework fun: ordering fabric for flags

One of the really cool, well designed features in MongoDB is the aggregation framework. Basically it is the feature that brings MongoDB query language on par with SQL in feature richness. Most importantly, it fully supports sharding for scale-out and parallel processing. I've had a lot of fun with it.

Last night I accidentally came up with a fun exercise that you can solve with a nice aggregation framework pipeline. I'll present it as a challenge, feel free to suggest answers in comments. I'll share my answer next week.

Suppose you work in a flag factory, and you have received the following orders:

> db.flags.find().pretty()
{
	"_id" : ObjectId("52a7189ecd4dd732cd060201"),
	"country" : "Finland",
hingo's picture

Translating reliably between XML and JSON (xml2json)

Last week I was assigned to work on a simple yet interesting problem. MongoDB stores data as JSON. But it turns out we often have customers - especially in the important financial services market segment - where data is in XML. (Yes, SOAP still exists too!) To store that data into MongoDB, we need to transform it into JSON.

(For the impatient reader: here's the Github link!)

Storing XML as a text field

There are various ways one could do this. For example one could simply store the XML document as a whole in a single field, and then extract just a few parts of the XML that are stored as individual JSON keys. One reason to do this is that they can then be indexed and used in queries.

For example:

Syndicate content