Created
December 6, 2012 19:37
-
-
Save coderoshi/4227614 to your computer and use it in GitHub Desktop.
Riak Javascript Client Usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.getAll('90s-emo', { | |
| where: { origin: "Madison, WI" } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.get('90s-emo', 'sunnyDayRealEstate', function(err, data) { | |
| if (data) { | |
| console.log(sys.inspect(data)); | |
| } else { | |
| console.log(error); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install riak-js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var db = require('riak-js').getClient({ | |
| host: TBA, port: TBA, clientId: myClientId | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.save('90s-emo', 'mineral', { | |
| bandName: "Mineral", | |
| origin: "Houston, TX", | |
| bestAlbum: "EndSerenading" | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.remove('90s-emo', 'myChemicalRomance'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment