I am Hack Sparrow
Captain of the Internets.

Archive for Database

MongoDB – Add Users and Authenticate

Before you add users to databases, you need to add admins to the MongoDB server. If the server is not running with the --auth option, all you have to do is call the db.addUser() function on the admin database. If it is running with the --auth option, you need to select the admin database and identify yourself as a valid admin. [code] > use admin > db.auth('root', 'w00t') ...

Neo4j Tutorial – REST API

After starting the Neo4j server, load the HTTP console by clicking here. The HTTP console uses the Neo4j REST API to interact with the database. Even though you can use the HTTP shell for manually interacting with the database, it is best used for prototyping the REST calls your app would be making to the database. Unless Neo4j provides bindings for your language (Java, Python, Ruby), you will most pro ...

Neo4j Tutorial – Introduction to Neo4j

When I set out to know Neo4j better, I couldn't easily find something which would get me started with Neo4j. Most articles and videos talked about theory or assumed you already knew the basics, and the examples were in Java; I couldn't find a straightforward tutorial which would show a non-Java guy how to start interacting with Neo4j. This tutorial is not meant to be an in-depth tutorial on Neo4j or graph databases. The intention of this introductory tutorial i ...

MongoDB Pagination – using $slice

Another technique of implementing pagination in MongoDB involves the use of $push and $slice. In this method, we store the documents in an array and use the $slice method to accomplish what skip()-and-limit() does, but without the overhead associated with the skip() method. We will be using a single root document in a collection with two fields: i. an arr ...

MongoDB Pagination – using range queries

This method of MongoDB pagination requires manually setting the _id field in your documents. It uses the min() and max() MongoDB cursor functions to implement the pagination. We'll be learning by examples on a collection named 'companies'. Make sure there are no documents on it. [code] db.companies.remove() [/code] Make sure the _id value starts from 0 and increment ...