Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require('dotenv').load();
- var Cloudant = require('cloudant');
- var username = process.env.cloudant_username;
- var password = process.env.cloudant_password;
- var cloudant = Cloudant({account:username, password:password});
- var db = cloudant.db.use('DATABASE');
- // Normal operation
- db.find({selector:{name:'NAME'}}, function(er, result) {
- if (er) {
- console.log(er);
- } else {
- console.log('Found %d documents with name NAME', result.docs.length);
- }
- });
- // Should error once, and terminate
- db.find('', function(er, result) {
- if (er) {
- console.log(er);
- } else {
- console.log('Found %d documents with name NAME', result.docs.length);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement