Hi,

i developed in node.js and CouchDB and have a problem with "function" and 
local/global variables.
My Code write and read in CouchDB, is running. But when both CouchWrite(); 
and CouchRead(); "Switches = undefined"
CouchWrite(); "or" CouchRead(); is running.


var couchdb = require('nano')('http://localhost:5984/');
var db = couchdb.use('udoodb');
CouchWrite();
CouchRead();


function CouchWrite() {
couchdb.db.destroy('udoodb', function()
{
couchdb.db.create('udoodb', function(err) {
if (err) {throw err; }
var doc1 = { sw1:false, sw2:false, sw3:false };
db.insert(doc1,'4662745328718336f506f9d2d3010c0c', function(err) {
if (err) {throw err; }
});
});
});
}

function CouchRead() {
db.get('4662745328718336f506f9d2d3010c0c', function(err, val) {
console.log('Switches =', val);
});
}

Thanks
Reiko

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to