Query works in web console but returns "Ambiguous reference to field" error in Node SDK

I am new to Couchbase and just finished setting everything up.

import couchbase from 'couchbase';

const myCluster = new couchbase.Cluster('couchbase://');
myCluster.authenticate('my_username', 'my_password');

export default myCluster;

This is the file where I init my cluster. In another file, I try to perform the following query among my users database:

import couchbase from 'couchbase';
import myCluster from '/path/to/couchbaseInit.js';

const N1qlQuery = couchbase.N1qlQuery;

const getDbIdQuery = "SELECT meta(`users`).id" +
"FROM `users`" +
"WHERE googleId=$UID";

 const getDbId = uid => new Promise((resolve, reject) => {
    myCluster.openBucket('users', '')
            {parameters: {UID: uid}},
            (error, results) => {
                if (error) reject(error);
		  	    else resolve(results[0].id);

Calling this method returns a “Ambiguous reference to field googleId” in Node console. Though from the web console, it returns the correct results :

Hi @Kushuh, it looks like you have a typo in your code. You need a space after .id or before FROM.

1 Like