From the course: Introduction to Couchbase
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Completing an INSERT, UPSERT, and DELETE - Couchbase Tutorial
From the course: Introduction to Couchbase
Completing an INSERT, UPSERT, and DELETE
- [Instructor] When getting started with Couchbase, you might find that it helps to spend a little time better understanding how to perform required application tasks. Let's talk about the common operations insert and delete and Couchbase's operation of upsert. As you probably already know an insert assumes a document does not exist and if the document for a given key does not exist the code provided inserts the document. This is the opposite of a delete operation assuming that a document does exist and the code provided removes that document from the database. An upsert is specific to Couchbase. It does not assume the preexistence of a document. And so it will take one of two actions. If a document does exist, that document is updated for a given key. And if the document does not exist, it is inserted just like an insert operation. Now, we'll return to the IDE to show you what an upsert looks like. This code should be familiar to you by now with the cluster information, the bucket…