Search code examples
couchbasesql++

Query Error on simple N1QL query , Error code 4010,


I am trying those queries, but I have an error in couchbase in all of them

SELECT * FROM `hostels` where ANY reqId IN data.identifier SATISFIES reqId.id  = "91" END;
"Keyspace not found keyspace hostels - cause: No bucket named hostels",

SELECT * FROM 'hostels' where ANY reqId IN data.identifier SATISFIES reqId.id  = "91" END;
"FROM expression term must have a name or alias"

SELECT * FROM "hostels" where ANY reqId IN data.identifier SATISFIES reqId.id  = "91" END;
"FROM expression term must have a name or alias",

Solution

  • The backticks are just necessary when your bucket name has a - in it (eg. travel-sample). This one should work as well:

    SELECT * FROM hostels where ANY reqId IN data.identifier SATISFIES reqId.id  = "91" END;
    

    There is nothing wrong with the query above, you probably misspelled the name of the bucket.