Bongo.js is a library for

storing and querying

structured data on the browser.



Lots of it.

Bongo.js is built on top of IndexedDB,

an HTML5 browser database technology.


If you tried using IndexedDB directly, you might cry.


Using Bongo.js is easy, peasy, lemon squeezy.


Make sure it's supported:

if(bongo.supported) {  // Woo hoo!}

Define a database:

bongo.db({
  name: 'zoo',
  objectStores: ["animals"]
}); 

Insert data:

bongo.zoo.animals.insert({  name: "Mr. Polar Bear",  species: "ursus maritimus",  hungry: true,  visitors_eaten: 2});


Save data:

bongo.zoo.animals.save({
 _id: 2 name: 'Happy Flappy Penguin',  species: "aptenodytes forsteri", hungry: true, hilarious: true});

Get a record by its ID:

bongo.zoo.animals.get(1,function(error, animal) {  if(error) return;  console.log('Do something with ' + animal.name);});


Find a record by some criteria:

bongo.zoo.animals.findOne({  hilarious:true},function(error,animal) {  if(error) return;  console.log(animal.name + ' is one little hilarious guy.');}); 

Find data:

bongo.zoo.animals.find({  hungry: true},function(error, animals) {  if(error) return;  // Do something with these hungry animals});

Yadda yadda, you get the point. Now go download Bongo.js.

Really, we're done here. Move along.

Bongo.js

By Aaron Shafovaloff