Changes from SDK 2.x to 3.0 and N1qlQuery

Is there a Doc which outlines the changes in the SDK between the 2.X and 3.o.

I know 3.o exposes the collection but does one have to use it ? I found out the cluster.authenticate has been removed in 3.0 but what causes me a some more issues is that it breaks other stuff as well.

Here is how i setup my connection which allows me to pass in the bucket name

   const cluster = new couchbase.Cluster(config.cluster, { username: config.userid, password: config.password});
    const bucketA = cluster.bucket('Contacts')
    const collA =  bucketA.defaultCollection()

    const bucketB = cluster.bucket('mail_store')
    const collB =  bucketB.defaultCollection()

    function bucketWithName(name) {
        let buckets = { "mail": collB, "contacts": collA}
        return buckets[name] || collA // this.bucket is default
    }

Then to make my N1QL Query i have this function

const n1qlQuery_wId = async(bucketName, queryStr, id) => {
            let coll = bucketWithName(bucketName)
            var up_sert = await coll.upsert('1234567890', {name:'Frank'})
            console.log(up_sert)
            up_sert = await coll.remove('1234567890')
            console.log(up_sert)
            in_sert = await coll.insert('1234567890',  {name:'Frank'})
            console.log(in_sert)
            var result = await coll.query(queryStr)
            console.log(result)
        }

So the above works fine for the regular doc upsert etc which means i have the reference to the default collection. But on coll.query it throws an error saying coll.query is not a function. After going thru some of the code it seems the query function is not part of the collection or bucket but the cluster. That makes sense since you don need a connection to a bucket to send a N1QL query. But if that’s the case the person in charge of the docs should do a better job addressing that and not use a previously used coll in the sample where coll was a collection and not cluster.

Hey @aponnath,
Thanks for the report! It does in fact appear that the documentation incorrectly references the collection to perform N1QL queries as opposed to the bucket. I’ll get that fixed as soon as possible.
Cheers, Brett

FYI you might want to change your reply to reflect that its the connection not bucket. So someone doesn’t read this and wonders why it does not work.