MongoLab
for Mobile Developers
Peter Traeg - March 24, 2012
Cloud based database solution
MongoDB - What is it?
Terminology
Databases
Collections
Documents
MongoLab - REST interface
Simple REST interface for CRUD operations:
Security is limited to your API key
Sample JSON data
[
{
"id":"ABC12",
"fname":"Peter",
"lname":"Johnson",
"email":"pete@acme.com",
"state":"NY"
},
{
"id":"ABC13",
"fname":"Mary",
"lname":"Jones",
"email":"mary@apple.com",
"state":"CA"
}
]
REST API Examples
View All Databases:
https://api.mongolab.com/api/1/databases/?apiKey=xxxx
View Collections in a Database:
https://api.mongolab.com/api/1/databases/approchester/collections?apiKey=xxxxx
REST API Examples
View All Documents in a Collection:
https://api.mongolab.com/api/1/databases/approchester/collections/customers?apiKey=xxxx
Query a collection for documents:
REST API Examples
Sort, and restrict the results to specific fields:
MongoDB Features
Geolocation searches - used by Foursquare
Indexes on attributes of a document
Ability to aggregate documents
Queries can span documents across collections
Issues with the REST based API
Limited security
Shared API key across databases
REST API is specific to MongoLab
Not all Mongo features are exposed.
Resources
mongolab.com
mongohq.com
10gen.com - creators of MongoDB
The End