Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dominique Sandoz
    @streunerlein
    hm
    i think im messing it up with them pipes...
    Nuno Job
    @dscape
    See
    Dominique Sandoz
    @streunerlein
            var dbWriteStream = db1.attachment.insert(doc._id, filename, null, type);
            var dbReadStream = db2.attachment.get(doc["ref-id"], orgfilename);
    
            dbReadStream.on('error', error);
    
            dbWriteStream.on('error', error);
    
            dbWriteStream.on('end', uploaded);
    
            dbReadStream.pipe(dbWriteStream);
    uploaded nor error get ever called :/
    am I using this right?
    Dominique Sandoz
    @streunerlein
    nevermind, updating my node version solved the problem :clap: i'm deeply sorry and embarrased
    hellboy81
    @hellboy81
    Hi, as I mentioned the best way to stub nano db instance in unit test is using sinon stubs?
    myMod(db, ...)
    hellboy81
    @hellboy81
    var sourceStream = fs.createReadStream(..)
    
    var destinationStream = db.attachment.insert(..)
    destinationStream.on('close', ...)
    destinationStream.on('error', ...)
    sourceStream.pipe(destinationStream)
    Should I also catch source stream errors in sourceStream.on('error'?
    In close event is returned response to client. Is this a better solution as with callback in db.attachment.insert(..., function(err,..) {...}
    hellboy81
    @hellboy81
    Wrong way: destinationStream can not emit on ('close', ..) event.
    It should be:
    sourceStream.on('close', ...)
    sourceStream.on('error', ...)
    And also destinationStream.on('error', ...)
    But what if sourceStream is request object?
    Andreas Lappe
    @alappe
    When I try to get a user document via db.get('org.couchdb.user:name@tld.com', …) I get a 404 because the document name is escaped via encodeURIComponent(). Is there another way to fetch a user obejct I miss, except doing the request by hand?
    Andreas Lappe
    @alappe
    Sorry, the request was missing the cookie and therefor returned a 404…
    Anil Ambati
    @aambati
    I am trying to debug a problem, i was wondering if any one know how to enable tracing in nano
    Tobie Langel
    @tobie
    Curious as to whether there are plans to add Promise support now that they're in ES.
    Benjamin Lupton
    @balupton
    Hey everyone, newbie to couchdb here, I'm trying to use nano to fetch all npm packages from the npm registry that match a particular keyword.
    Using the registry's web interface, I can use http://registry.npmjs.org/-/_view/byKeyword?startkey=["docpad-plugin"]&endkey=["docpad-plugin",{}]&group_level=3
    How would I access that data via nano?
    Dominique Sandoz
    @streunerlein
    hi @balupton , you should be able to use the couch on https://skimdb.npmjs.com/
    i guess your equivalent view is at https://skimdb.npmjs.com/registry/_design/app
    Dominique Sandoz
    @streunerlein
    so, this you should be able to query with the nano.view method,
    var nano = require('nano')('https://skimdb.npmjs.com');
    var registry = nano.db.use('registry');
    registry.view('app', 'byKeyword', {startkey: ["docpad_plugin"], endkey: ["docpad_plugin", {}], group_level: 3}, function(err, body) { if (err) return console.log(err); console.log(body.rows.length, "found"); });
    oops, i made a typo - of course your query is for docpad-plugin and not docpad_plugin (correct in startkey and endkey)
    Benjamin Lupton
    @balupton
    @streunerlein it works! yay!
    so how did you know to use skimdb.npmjs.com instead of registry.npmjs.com ?
    Dominique Sandoz
    @streunerlein
    I googled ;) after realizing, that registry.npmjs.com isnt really a vanilla couch interface...
    Hendrik Roth
    @HendrikRoth
    Hello - short question, how(is it possible?) can i set permissions for a new created database by nano.db.create?
    Hendrik Roth
    @HendrikRoth
    No idea? :(
    Dominique Sandoz
    @streunerlein
    Hi @henn1nk , you usually do this by adding a _security document (see http://docs.couchdb.org/en/latest/intro/security.html)
    With nano, this would be a simple insert https://github.com/dscape/nano#dbinsertdoc-params-callback, so
    nano.db.create('db_name'), db = nano.use('db_name'), db.insert({_id: "_security", ...});
    (think that this notation is sequential for simplifying things, but keep in mind that the real operations are async...)
    Hendrik Roth
    @HendrikRoth
    @streunerlein thanks
    Hendrik Roth
    @HendrikRoth
    can i check with nano the db size?
    ah found it. db.get..
    Elliot
    @Elliot128

    Hello, I am using nano to convert a couchDB to postresql. I am using the get method to get documents, however, I get the econnreset error many times during the batch command. It looks like:

    body.rows.forEach(function(doc, index) {
    brokerDealers.get(doc.id, function(err, body, header) {
    }
    }

    Dominique Sandoz
    @streunerlein
    Hi @elliotatRetireup,
    my first guess would be that it's just too many connections. Try either to use a view with the include_docs parameter (which gives you all the docs) or use the async library with a limit-function (like seriesLimit or similar). Anyway, i would try to load as many docs in as few requests as possible.
    Elliot
    @Elliot128
                            async.forEachOfSeries(body.rows,function(row, key, callback) {
    
    
                                brokerDealers.get(row.id, function(err, body, header) {
    Good idea! I modified it to use async for each series. So now it is calling broker dealers.get then waiting for the callback. Unfortunately the .get command still gives me an error after a few rows.
    etimedout is the error
    Hendrik Roth
    @HendrikRoth
    hmmm i have no idea why, but it seams that nano.multipart.insert breaks my file... my data is a base64 string.
    Dominique Sandoz
    @streunerlein
    @elliotatRetireup no you did not quite understand what i meant. Try not to make a request for every doc, try to make one request in total. Read about views and include_docs. Or alternatively, use a LIMIT function of async (function name has to include "limit" as in eachLimit)
    @henn1nk make sure you took care of these things here http://stackoverflow.com/questions/26739928/couchdb-nano-multipart-insert it should not be b64 if that is not really what you want it to be as a file
    Hendrik Roth
    @HendrikRoth
    @streunerlein found the solution... a base64 string was wrong. i needed to upload blob. works now.
    Elliot
    @Elliot128
    @streunerlein Yes you are correct. I ended up removing the process of getting each doc one at a time. I ended up building a view in couch then grabbing the view via nano. Thanks again for the help, I was just getting started with nodejs at the time.
    And also async was a huge help with that too.
    Hendrik Roth
    @HendrikRoth
    can i do updates in nano, which only updates a part ofd a doc?
    Hendrik Roth
    @HendrikRoth
    i mean couchdb's "update" function
    ah. nano.atomic ... found it. sorry