Home » Tag Archives: MongoDB

Tag Archives: MongoDB

Develop RESTful APIs using MongoDB and Nodejs

In this article, we will learn how to build Restful API’s from scratch using node and NoSQL databases like MongoDB. For starters let’s understand our development stack before we start building our application. Node.js is an open source javascript runtime designed to build scalable applications and uses an event-driven and non-blocking I/O. Node.js is designed keeping low latency and streaming ...

Read More »

Test MongoDB Failure Scenarios With MockupDB

This is the fifth article in my series on “black pipe” testing. Traditional black box tests work well if your application takes inputs and returns output through one interface: the API. But connected applications have two interfaces: both the API and the messages they send and receive on the network. I call the validation of both ends a black pipe ...

Read More »

MockupDB: Testing The MongoDB C Driver With Python

This is the third article in my series on “black pipe” testing. The series describes how to test networked code, like a MongoDB driver. Such code has two distinct public surfaces: one is its API, and the other is its communication over the network. Treating it as a black box tests just one surface, the API. To test both, we ...

Read More »

Testing PyMongo As A Black Pipe

This is the second article in my six-part series on “black pipe” testing. PyMongo, the official Python client for MongoDB, is a great example of a connected application that can’t be fully tested as a black box. It has two ends that take inputs and provide outputs: one is its public API, the methods find and insert_one and so on. ...

Read More »

The MongoDB Shell’s New CRUD API

We released the latest development version of MongoDB the other week. The official announcement focuses on bug fixes, but I’m much more excited about a new feature: the mongo shell includes the new CRUD API! In addition to the old insert, update, and remove, the shell now supports insertMany, replaceOne, and a variety of other new methods. Why do I ...

Read More »

PyMongo And Key Order In Subdocuments

Or, "Why does my query work in the shell but not PyMongo?" Variations on this question account for a large portion of the Stack Overflow questions I see about PyMongo, so let me explain once for all. MongoDB stores documents in a binary format called BSON. Key-value pairs in a BSON document can have any order (except that _id is ...

Read More »

Testing Network Errors With MongoDB

Someone asked on Twitter today for a way to trigger a connection failure between MongoDB and the client. This would be terribly useful when you’re testing your application’s handling of network hiccups. You have options: you could use mongobridge to proxy between the client and the server, and at just the right moment, kill mongobridge. Or you could use packet-filtering ...

Read More »

Real-time Profiling a MongoDB Sharded Cluster

In a sharded cluster of replica sets, which server or servers handle each of your queries? What about each insert, update, or command? If you know how a MongoDB cluster routes operations among its servers, you can predict how your application will scale as you add shards and add members to shards. Operations are routed according to the type of ...

Read More »

Efficiently Paging Geospatial Data With MongoDB

From release 2.6, MongoDB includes a new minDistance option for geospatial queries. This is exciting because it lets you page through geospatial results very efficiently, and because it’s the first feature I’ve contributed to the database itself. I’ll measure how minDistance performs and show you an example app. Better, Faster I’m going to fill a MongoDB collection with the locations ...

Read More »