You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorial/markdown/c++/cxx-quickstart.md
+3-44Lines changed: 3 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,7 @@ length: 30 Mins
24
24
---
25
25
26
26
<!-- [abstract] -->
27
-
# Quickstart in Couchbase C++
28
-
29
-
- Learn to build applications in with Couchbase C++ SDK.
30
-
- See how you can fetch data from Couchbase using SQL++ queries
31
-
- Explore CRUD operations in action with Couchbase
32
-
- Learn about Search Indexes and execute search queries in C++
27
+
# Quickstart for Couchbase in C++
33
28
34
29
In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents, how to write simple parametrized SQL++ queries and how to create, and perform simple and complex text search using Search indexes.
35
30
@@ -38,7 +33,6 @@ In this tutorial, you will learn how to connect to a Couchbase Capella cluster t
38
33
To run this prebuilt project, you will need:
39
34
40
35
-[Couchbase Capella](https://www.couchbase.com/products/capella/) cluster or a self managed Couchbase cluster with [travel-sample](https://docs.couchbase.com/python-sdk/current/ref/travel-app-data-model.html) bucket loaded.
41
-
- To run this tutorial using a self managed Couchbase cluster, please refer to this [section](##Running-Self-Managed-Couchbase-Cluster).
42
36
43
37
-[CMake](https://cmake.org/) 3.9 or higher installed
44
38
-[C++17](https://en.cppreference.com/w/cpp/17) and a compatible compiler, [clang++](https://clang.llvm.org/) or [g++](https://gcc.gnu.org/)
@@ -115,12 +109,6 @@ At this point, we have installed the dependencies, loaded the travel-sample data
115
109
Once you run the executable, your terminal should fill up with the results of the executed statements written in the main function of the `main.cpp` and should look something like this:
116
110

117
111
118
-
### Running Self Managed Couchbase Cluster
119
-
120
-
If you are running this quickstart with a self managed Couchbase cluster, you need to [load](https://docs.couchbase.com/server/current/manage/manage-settings/install-sample-buckets.html) the travel-sample data bucket in your cluster and generate the credentials for the bucket.
121
-
122
-
You need to update the connection string and the credentials in the `set_env_vars.sh` file in the source folder and run `source set_env_vars.sh` to set them.
123
-
124
112
125
113
### Running Tests
126
114
@@ -136,38 +124,9 @@ For this quickstart, we use one collection, `airline` and `hotels` collection t
136
124
You can find the schema for both these collections in the model folder.
137
125
138
126
139
-
## Let Us Review the Code
127
+
## Code Review
140
128
141
-
To begin this tutorial, clone the repo and open it up in the IDE of your choice. Now you can learn about how to create, read, update and delete documents in Couchbase Server.
142
-
143
-
### Code Layout
144
-
145
-
```
146
-
├── CMakeLists.txt
147
-
├── README.md
148
-
├── cmake
149
-
│ └── CPM.cmake
150
-
├── db.cpp
151
-
├── db.h
152
-
├── hotel_search_index.json
153
-
├── images
154
-
│ └── cli_output.png
155
-
├── include
156
-
├── main.cpp
157
-
├── model
158
-
│ ├── airline.json
159
-
│ └── hotel.json
160
-
├── operations.cpp
161
-
├── operations.h
162
-
├── runner.cpp
163
-
├── set_env_vars.sh
164
-
└── tests
165
-
├── CMakeLists.txt
166
-
├── test_doc.json
167
-
├── test_index.json
168
-
├── test_index2.json
169
-
└── tests.cpp
170
-
```
129
+
To begin this tutorial, clone the repo and open it up in the IDE of your choice. Now you can explore about how to interact with Couchbase Server using the C++ SDK.
171
130
172
131
We have separated out the SDK code and the main function. The `db.h` and `db.cpp` contain the declaration and the implementation of utility functions we will use to parse environment variables and create a connection to the cluster. `operations.h` and `operations.cpp` contain all the functions that perform operations on the db. Both `db.cpp` and `operations.cpp` are combined to make a static library. The tests are similarly separated out in the `tests` folder which utilise the library created earlier. The `main.cpp` is the executable which is also built by linking the library and contains code that demonstrates the usage of the functions we defined earlier to initeract with the db.
0 commit comments