FROM customer USE KEYS ["cx:123"]
Couchbase is a distributed database. It supports a flexible data model using JSON. Each document in a bucket will have a user-generated unique document key. This uniqueness is enforced during the insertion or updation of the data. Here’s an example document.
select meta().id, travel
from `travel-sample` travel
where type = 'airline' limit 1;
[
{
"id": "airline_10",
"travel": {
"callsign": "MILE-AIR",
"country": "United States",
"iata": "Q5",
"icao": "MLA",
"id": 10,
"name": "40-Mile Air",
"type": "airline"
}
}
]
INSERT INTO customer (key, value) VALUES(“cx:123”, {“name”:”joe”, “zip”: 94040, “state”:ca});
SELECT META().id FROM customer;
cx:123