{"id":10366,"date":"2024-02-02T03:36:21","date_gmt":"2024-02-02T11:36:21","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/quickstart-ottomanjs\/"},"modified":"2024-02-02T03:36:21","modified_gmt":"2024-02-02T11:36:21","slug":"quickstart-ottomanjs","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/","title":{"rendered":"Using Ottoman.js and Express"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this tutorial, you will learn how to connect to a Couchbase cluster using <a href=\"https:\/\/ottomanjs.com\/\">Ottoman JS<\/a> instead of the NodeJS SDK to create, read, update, and delete documents, and write simple parametrized SQL++ queries.<\/p>\n\n\n\n<h3 id=\"h-prerequisites\" class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To run this prebuilt project, you will need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p><a href=\"https:\/\/www.couchbase.com\/products\/capella\/\">Couchbase Capella<\/a> cluster with <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/ref\/travel-app-data-model.html\">travel-sample<\/a> bucket loaded.<\/p>\n<ul>\n<li>To run this tutorial using a self managed Couchbase cluster, please refer to the <a href=\"#running-self-managed-couchbase-cluster\">appendix<\/a>.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p>NodeJS &amp; NPM<\/p>\n<\/li>\n\n\n<li>\n<p>Loading Travel Sample Bucket\nIf travel-sample is not loaded in your Capella cluster, you can load it by following the instructions for your Capella Cluster:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">Load travel-sample bucket in Couchbase Capella<\/a><\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note that this tutorial is designed to work with the latest Ottoman version (2) for Couchbase. It will not work with the older Ottoman versions for Couchbase without adapting the code.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-couchbase-capella-configuration\" class=\"wp-block-heading\">Couchbase Capella Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When running Couchbase using <a href=\"https:\/\/cloud.couchbase.com\/\">Capella<\/a>, the following prerequisites need to be met.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The application requires the travel-sample bucket to be <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">loaded<\/a> in the cluster from the Capella UI.<\/li>\n\n\n<li>Create the <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\">database credentials<\/a> to access the travel-sample bucket (Read and Write) used in the application.<\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\">Allow access<\/a> to the Cluster from the IP on which the application is running.<\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-app-setup\" class=\"wp-block-heading\">App Setup<\/h3>\n\n\n\n<h4 id=\"h-cloning-repo\" class=\"wp-block-heading\">Cloning Repo<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>git clone https:\/\/github.com\/couchbase-examples\/ottomanjs-quickstart.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-install-dependencies\" class=\"wp-block-heading\">Install Dependencies<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Any dependencies will be installed by running the npm install command from the root directory of the project.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>npm install\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-setup-database-configuration\" class=\"wp-block-heading\">Setup Database Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To know more about connecting to your Capella cluster, please follow the <a href=\"https:\/\/docs.couchbase.com\/cloud\/get-started\/connect.html\">instructions<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically, you need to do the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\">database credentials<\/a> to access the travel-sample bucket (Read and Write) used in the application.<\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\">Allow access<\/a> to the Cluster from the IP on which the application is running.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">All configuration for communication with the database is read from the environment variables. We have provided a convenience feature in this quickstart to read the environment variables from a local file, <code>dev.env<\/code> in the <code>config<\/code> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a copy of <code>config\/dev.env.example<\/code> file and rename it to <code>config\/dev.env<\/code> and add the values for the Couchbase connection.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>DB_CONN_STR=&lt;connection_string&gt;\nDB_USERNAME=&lt;user_with_read_write_permission_to_travel-sample_bucket&gt;\nDB_PASSWORD=&lt;password_for_user&gt;\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The connection string expects the <code>couchbases:\/\/<\/code> or <code>couchbase:\/\/<\/code> part.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-running-the-application\" class=\"wp-block-heading\">Running the Application<\/h3>\n\n\n\n<h4 id=\"h-directly-on-local-machine\" class=\"wp-block-heading\">Directly on Local Machine<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, we have installed the dependencies, loaded the travel-sample data and configured the application with the credentials. The application is now ready and you can run it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application will run on port 3000 of your local machine (<a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>). You will find the Swagger documentation of the API which you can use to try the API endpoints.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code># Execute this command in the project&#039;s root directory\nnpm start\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-docker\" class=\"wp-block-heading\">Docker<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer to run this quick start using Docker, we have provided the Dockerfile which you can use to build the image and run the API as a container.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>cd src\ndocker build -t couchbase-ottoman-quickstart .\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>docker run -it --env-file config\/dev.env -p 3000:3000 couchbase-ottoman-quickstart\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The <code>config\/dev.env<\/code> file has the connection information to connect to your Capella cluster. With the <code>--env-file<\/code>, docker will inject those environment variables to the container.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Once the app is up and running, you can launch your browser and go to the <a href=\"https:\/\/localhost:3000\/\">Swagger documentation<\/a> to test the APIs.<\/p>\n\n\n\n<h4 id=\"h-verifying-the-application\" class=\"wp-block-heading\">Verifying the Application<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Once the application starts, you can see the details of the application on the logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"ottoman_app_startup.png\" alt=\"Application Startup\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application will run on port 3000 of your local machine (<a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>). You will find the interactive Swagger documentation of the API if you go to the URL in your browser. Swagger documentation is used in this demo to showcase the different API end points and how they can be invoked. More details on the Swagger documentation can be found in the <a href=\"#swagger-documentation\">appendix<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"ottoman_swagger_documentation.png\" alt=\"Swagger Documentation\"><\/p>\n\n\n\n<h3 id=\"h-data-model\" class=\"wp-block-heading\">Data Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we use three collections, <code>airport<\/code>, <code>airline<\/code> and <code>route<\/code> that contain sample airports, airlines and airline routes respectively. The route collection connects the airports and airlines as seen in the figure below. We use these connections in the quickstart to generate airports that are directly connected and airlines connecting to a destination airport. Note that these are just examples to highlight how you can use SQL++ queries to join the collections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"travel_sample_data_model.png\" alt=\"img\"><\/p>\n\n\n\n<h3 id=\"h-let-us-review-the-code\" class=\"wp-block-heading\">Let Us Review the Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h4 id=\"h-code-layout\" class=\"wp-block-heading\">Code Layout<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\u251c\u2500\u2500 src\/controllers\n\u2502   \u251c\u2500\u2500 airlineController.js\n\u2502   \u251c\u2500\u2500 airportController.js\n\u2502   \u2514\u2500\u2500 routeController.js\n\u251c\u2500\u2500 db\n\u2502   \u251c\u2500\u2500 ottomanConnection.js\n\u251c\u2500\u2500 src\/routes\n\u2502   \u251c\u2500\u2500 airline.js\n\u2502   \u251c\u2500\u2500 airport.js\n\u2502   \u251c\u2500\u2500 route.js\n\u251c\u2500\u2500 src\/shared\n\u2502   \u251c\u2500\u2500 makeResponse.js\n\u251c\u2500\u2500 src\/app.js\n\u251c\u2500\u2500 src\/server.js\n\u251c\u2500\u2500 Dockerfile\n\u2514\u2500\u2500 __test__\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We have separated out the  code into separate files by the entity (collection) in the <code>controllers<\/code> folder. The tests for the  project are present in the <code>__test__<\/code> folder.<\/p>\n\n\n\n<h4 id=\"h-airport-entity\" class=\"wp-block-heading\">Airport Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we will focus on the airport entity. The other entities are similar.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will be setting up a REST API to manage airport documents.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#post-airport\">POST Airport<\/a> \u2013 Create a new airport<\/li>\n\n\n<li><a href=\"#get-airport\">GET Airport<\/a> \u2013 Read specified airport<\/li>\n\n\n<li><a href=\"#put-airport\">PUT Airport<\/a> \u2013 Update specified airport<\/li>\n\n\n<li><a href=\"#delete-airport\">DELETE Airport<\/a> \u2013 Delete airport<\/li>\n\n\n<li><a href=\"#list-airport\">Airport List<\/a> \u2013 Get all airports. Optionally filter the list by country<\/li>\n\n\n<li><a href=\"#direct-connections\">Direct Connections<\/a> &#8211; Get a list of airports directly connected to the specified airport<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For CRUD operations, we will use the <a href=\"https:\/\/ottomanjs.com\">Ottoman JS<\/a>, an object-document mapping built on top of the <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/hello-world\/start-using-sdk.html\">Couchbase NodeJS SDK<\/a> to create, read, update, and delete a document. Every document will need an ID (similar to a primary key in other databases) to save it to the database. For other end points, we will use <a href=\"https:\/\/ottomanjs.com\/docs\/quick-start#write-a-query-with-ottomans-query-api\">Ottoman Query API<\/a> to query for documents.<\/p>\n\n\n\n<h3 id=\"h-document-structure\" class=\"wp-block-heading\">Document Structure<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Our airport document will have an airportname, city, country, faa code, icao code, timezone info and the geographic coordinates. For this demo, we will store all airport information in one document in the <code>airport<\/code> collection in the <code>travel-sample<\/code> bucket.<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;airportname&quot;: &quot;Sample Airport&quot;,\n  &quot;city&quot;: &quot;Sample City&quot;,\n  &quot;country&quot;: &quot;United Kingdom&quot;,\n  &quot;faa&quot;: &quot;SAA&quot;,\n  &quot;icao&quot;: &quot;SAAA&quot;,\n  &quot;tz&quot;: &quot;Europe\/Paris&quot;,\n  &quot;geo&quot;: {\n    &quot;lat&quot;: 48.864716,\n    &quot;lon&quot;: 2.349014,\n    &quot;alt&quot;: 92\n  }\n}\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-creating-an-ottoman-schema-and-model-for-our-airport-documents\" class=\"wp-block-heading\">Creating an Ottoman Schema and Model for our Airport documents<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To work with documents in Ottoman we must first set up our <code>Schema<\/code> and <code>model<\/code>, let&#8217;s take a look at the <code>\/models\/airportModel.js<\/code> before moving onto the <code>App.js<\/code> and related code:<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>import { model, Schema } from &#039;ottoman&#039;\n\n\/\/ Geo sub-schema\nconst GeoSchema = new Schema({\n  alt: { type: Number },\n  lat: { type: Number },\n  lon: { type: Number },\n});\n\nconst AirportSchema = new Schema({\n  airportName: { type: String, required: true },\n  city: { type: String, required: true },\n  country: { type: String, required: true },\n  faa: { type: String, required: true },\n  geo: GeoSchema,\n  icao: { type: String, required: false },\n  tz: { type: String, required: false },\n});\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And finally we define our <code>model<\/code> using this <code>Schema<\/code> where we specify <code>collectionName<\/code> and <a href=\"https:\/\/ottomanjs.com\/docs\/advanced\/how-ottoman-works#keygenerator-function\"><code>keyGeneratorDelimiter<\/code><\/a> as we do not plan on using the default which is <code>::<\/code> on travel-sample bucket :<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>const AirportModel = model(&quot;airport&quot;, AirportSchema, {\n  modelKey: &quot;type&quot;,\n  collectionName: &quot;airport&quot;,\n  keyGeneratorDelimiter: &quot;_&quot;,\n});\n\nmodule.exports = {\n  AirportModel,\n};\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s go over the <code>server.js<\/code> and the <code>App.js<\/code> files located in the <code>\/src<\/code> directory. Let&#8217;s open the <code>server.js<\/code> file first to see how it kicks off the application server and then the <code>App.js<\/code> file to learn about how we create, read, update and delete documents in our database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>src\/server.js<\/code>:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>server.js<\/code> file bootstraps our application, it imports some definitions from our <code>app.js<\/code> file, and connects to our server through <a href=\"https:\/\/ottomanjs.com\/docs\/api\/modules#connect\"><code>ottoman.connect()<\/code><\/a>. The call to <a href=\"https:\/\/ottomanjs.com\/docs\/api\/modules#start\"><code>ottoman.start()<\/code><\/a> method is just a shortcut to run <code>ensureCollections<\/code> and <code>ensureIndexes<\/code> (Ottoman&#8217;s methods ensuring collections and indexes exist or get created by Ottoman).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we start up the express application by listening to our desired port.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>import { app, ottoman } from &#039;.\/app.js&#039;\n\nconst startApiServer = async() =&gt; {\n  try {\n    await ottoman.connect({\n      bucketName: process.env.CB_BUCKET,\n      connectionString: process.env.CB_URL,\n      username: process.env.CB_USER,\n      password: process.env.CB_PASS,\n    })\n    \/\/ By default start function will wait for indexes, but you can disable it setting ignoreWatchIndexes to true. \n    \/\/ It&#039;s not required to execute the start method in order for Ottoman work.\n    await ottoman.start()\n    \n    const port = process.env.APP_PORT\n    app.listen(port, () =&gt; {\n      console.log(`API started at http:\/\/localhost:${port}`)\n      console.log(`API docs at http:\/\/localhost:${port}\/api-docs\/`)\n    })\n  } catch (e) {\n    console.log(e)\n  }\n}\n\nstartApiServer()\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>src\/app.js<\/code>:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We import our dependencies and database connection:<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>import express from &quot;express&quot;;\nimport cors from &quot;cors&quot;;\nimport { ottoman, Query } from &quot;..\/db\/ottomanConnection&quot;;\nimport airlineRoutes from &quot;.\/routes\/airline&quot;;\nimport airportRoutes from &quot;.\/routes\/airport&quot;;\nimport route from &quot;.\/routes\/route&quot;;\nimport swaggerUi from &quot;swagger-ui-express&quot;;\nimport YAML from &quot;yamljs&quot;;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">One of our import statements in this file pulls in: <a href=\"https:\/\/github.com\/couchbase-examples\/ottomans-quickstart\/blob\/master\/db\/ottomanConnection.js\"><code>\/db\/ottomanConnection.js<\/code><\/a>. This gives us access to some of the Ottoman resources we need for our endpoints to persist data to Couchbase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>import { Ottoman, getOttomanInstances, getDefaultInstance, ValidationError, FindOptions, SearchConsistency,Query } from &#039;ottoman&#039;\n\nconst ottoman = new Ottoman({\n  modelKey: &#039;type&#039;,\n  scopeName: &#039;inventory&#039;\n})\n\nmodule.exports = { ottoman, getOttomanInstances, getDefaultInstance, ValidationError, FindOptions, SearchConsistency,Query }\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>ottomanConnection.js<\/code> file in the <code>db<\/code> folder, we forward the assets from Ottoman that we will use in <code>App.js<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">After we have our configuration for database connection in place, we can create our express app:<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>const app = express()\n\napp.use(cors())\napp.use(express.json())\napp.use(express.urlencoded({ extended: true }))\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-shared-directory\" class=\"wp-block-heading\">Shared Directory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <code>src\/shared<\/code> folder and navigate to the <code>makeResponse.js<\/code> which contains a asynchronous function <code>makeResponse<\/code> for handling Express responses, executing provided actions, and managing errors. It specifically logs errors, sets appropriate HTTP status codes, and responds with a JSON object containing the error message. The status code is determined based on whether the error is a ValidationError or contains the string &#8220;not found.&#8221;<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>import { ValidationError} from &#039;..\/..\/db\/ottomanConnection&#039;\n\nasync function makeResponse(res, action) {\n  try {\n    const result = await action()\n    res.json(result)\n  } catch (e) {\n    const status = e.message !== undefined &amp;&amp; e.message.indexOf(&#039;not found&#039;) !== -1 ? 404 : 500\n    res.status(e instanceof ValidationError ? 400 : status)\n    res.json({ message: e.message })\n  }\n}\n\nmodule.exports = {\n  makeResponse\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-post-airport\" class=\"wp-block-heading\">POST Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To insert a new airport document, locate the createAirline method within the <code>airportController<\/code> file found in the <code>controllers<\/code> package. This expects a POST request with the airport data provided in the request body.\nWe extract this airport ID from the airport data, check if there is a document with the same key, and create a airport document using Ottoman&#8217;s <a href=\"https:\/\/ottomanjs.com\/docs\/basic\/model#constructing-documents\"><code>.save()<\/code><\/a> method and our model named: <code>AirlineModel<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  try {\n    \/\/ Try to find an existing document with the given ID\n    const existingAirline = await AirlineModel.findById(req.body.id);\n\n    if (existingAirline) {\n      \/\/ Document with the same id already exists\n      return res.status(409).json({ message: &quot;Duplicate key error&quot; });\n    }\n  } catch (error) {\n    \/\/ Ignore the error (i.e document with key not found, proceed to create)\n  }\n  await makeResponse(res, async () =&gt; {\n    const airline = new AirlineModel(req.body);\n    await airline.save();\n    res.status(201);\n    return airline;\n  });\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s break this code down.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After we check for required body parameters, we create a call to the <code>makeResponse()<\/code> to handle a call to ottoman&#8217;s <code>save()<\/code>. We create a airport document with <code>airport.save()<\/code> and the airport it uses confirms to its Ottoman model called <code>airportModel<\/code>.<\/p>\n\n\n\n<h3 id=\"h-get-airport\" class=\"wp-block-heading\">GET Airport<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To fetch a airport document, locate the getAirport method within the <code>airportController.js<\/code> file found in the <code>controllers<\/code> package. This expects a GET request with the airport document ID (id) specified in the URL path.\nWe extract this airport document ID from the URL and retrieve a Airport document using Ottoman&#8217;s <a href=\"https:\/\/ottomanjs.com\/docs\/api\/interfaces\/imodel.html#findbyid\"><code>.findById()<\/code><\/a> method using the <code>AirportModel<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  await makeResponse(res, async () =&gt; {\n    const airline = await AirlineModel.findById(req.params.id);\n    return airline;\n  });\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We only need the airport ID from the user to retrieve a particular airport document using a basic key-value operation. We catch the error if the key-value operation fails and return an error message.<\/p>\n\n\n\n<h3 id=\"h-put-airport\" class=\"wp-block-heading\">PUT Airport<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To update a airport document, locate the updateAirline method within the <code>airportController.js<\/code> file found in the <code>controllers<\/code> package.\nThis expects a PUT request with the airport ID (id) specified in the URL path and the airport data to be updated provided in the request body.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  await makeResponse(res, async () =&gt; {\n    const airline = AirlineModel.replaceById(req.body.id, req.body);\n    return airline;\n  });\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>UpdateAirport<\/code> method calls the <a href=\"https:\/\/ottomanjs.com\/docs\/api\/interfaces\/imodel.html#replacebyid\"><code>replaceyId()<\/code><\/a> method.<\/p>\n\n\n\n<h3 id=\"h-delete-airport\" class=\"wp-block-heading\">DELETE Airport<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To delete a airport document, locate the DeleteDocumentForAirport method within the <code>airportController.js<\/code> file found in the <code>controllers<\/code> package.\nThis expects a DELETE request with the airport document ID (id) specified in the URL path.\nWe just need to supply the <code>id<\/code> of the document we want to remove.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  await makeResponse(res, async () =&gt; {\n    await AirlineModel.removeById(req.params.id);\n    res.status(204);\n  });\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Delete Airport by Airport ID by using Ottoman&#8217;s <a href=\"https:\/\/ottomanjs.com\/docs\/api\/interfaces\/imodel.html#removebyid\"><code>removeById()<\/code><\/a> method on the <code>AirportModel<\/code> and returns a 404 if the document is not found.<\/p>\n\n\n\n<h3 id=\"h-list-airport\" class=\"wp-block-heading\">List Airport<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint retrieves the list of airports in the database. The API has options to specify the page size for the results and country from which to fetch the airport documents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/howtos\/n1ql-queries-with-sdk.html\">SQL++<\/a> is a powerful query language based on SQL, but designed for structured and flexible JSON documents. We will use a SQL+ query to search for airports with Limit, Offset, and Country option. The SQL++ query is built using the models <a href=\"https:\/\/ottomanjs.com\/docs\/basic\/query-builder#query-builder--model-find-method\">find method.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>listAirports<\/code> method in the <code>airportController.js<\/code> file. This endpoint is different from the others we have seen before because it makes the SQL++ query rather than a key-value operation. This usually means more overhead because the query engine is involved. For this query, we are using the predefined indices in the <code>travel-sample<\/code> bucket. We can create an additional <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/services-and-indexes\/indexes\/indexing-and-query-perf.html\">index<\/a> specific for this query to make it perform better.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we need to get the values from the query string for country, limit, and Offset that we will use in our query. These are pulled from the <code>request.query<\/code> method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This end point has two queries depending on the value for the country parameter. If a country name is specified, we retrieve the airport documents for that specific country. If it is not specified, we retrieve the list of airports across all countries. The queries are slightly different for these two scenarios.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Ottoman&#8217;s <a href=\"https:\/\/ottomanjs.com\/docs\/basic\/query-builder#query-builder--model-find-method\"><code>find()<\/code><\/a> method takes the paramters we received from the user as options.<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  const country = req.query.country || &quot;&quot;;\n  const limit = parseInt(req.query.limit, 10) || 10;\n  const offset = parseInt(req.query.offset, 10) || 0;\n  let filter = {};\n  if (country) {\n    filter.country = country;\n  }\n\n  const options = { limit: limit, offset: offset };\n  await makeResponse(res, async () =&gt; {\n    const airports = await AirportModel.find(filter, options);\n    return airports.rows;\n  });\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-direct-connections\" class=\"wp-block-heading\">Direct Connections<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint fetches the airports that can be reached directly from the specified source airport code. This uses the query builder to create the SQL++ query and fetch the results simlar to the List Airport endpoint but uses the ottoman instance to query the result via the <a href=\"https:\/\/ottomanjs.com\/docs\/basic\/query-builder#query-builder--model-find-method\">query builder<\/a> by first creating the sub query and then using the build method on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let us look at the sub query being created here:<\/p>\n\n\n\n<pre class=\"wp-block-code language-js\"><code>  const airport = req.query.airport;\n  const limit = parseInt(req.query.limit, 10) || 10;\n  const offset = parseInt(req.query.offset, 10) || 0;\n  \/\/ Subquery to get distinct airline IDs\n  const subquery = new Query({}, &quot;travel-sample.inventory.route&quot;)\n    .select([{ $field: &quot;DISTINCT route.destinationairport&quot; }])\n    .plainJoin(\n      &quot;JOIN `travel-sample`.inventory.airport AS airport ON route.sourceairport = airport.faa&quot;,\n    )\n    .where({\n      &quot;airport.faa&quot;: { $eq: airport },\n      &quot;route.stops&quot;: { $eq: 0 },\n    })\n    .orderBy({ &quot;route.destinationairport&quot;: &quot;ASC&quot; })\n    .limit(limit)\n    .offset(offset);\n\n  await makeResponse(res, async () =&gt; {\n    const result = await ottoman.query(subquery.build());\n    return result.rows;\n  });\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We are fetching the direct connections by joining the airport collection with the route collection and filtering based on the source airport specified by the user and by routes with no stops.<\/p>\n\n\n\n<h4 id=\"h-project-setup-notes\" class=\"wp-block-heading\">Project Setup Notes<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We have set up a <code>.babelrc<\/code> file at the root of our project so that we can use ES6 and imports in our project:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;presets&quot;: [\n    &quot;@babel\/preset-env&quot;\n  ]\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We have created a start script in our <code>package.json<\/code> that executes babel-node and the starting point of our application <code>src\/server.js<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>&quot;scripts&quot;: {\n  &quot;start&quot;: &quot;env-cmd .\/config\/dev.env nodemon --exec babel-node src\/server&quot;,\n},\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There are other scripts that we have added for our maintenance and testing of the project on GitHub using GitHub actions.<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>  &quot;scripts&quot;: {\n    &quot;start&quot;: &quot;env-cmd -f .\/config\/dev.env nodemon --exec babel-node src\/server&quot;,\n    &quot;test&quot;: &quot;env-cmd -f .\/config\/test.env jest --verbose --forceExit --detectOpenHandles&quot;,\n    &quot;testGA&quot;: &quot;jest --verbose --runInBand&quot;,\n    &quot;clean&quot;: &quot;rm -rf dist&quot;,\n    &quot;build&quot;: &quot;npm run clean &amp;&amp; babel .\/src --out-dir dist --copy-files&quot;\n  },\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-running-tests\" class=\"wp-block-heading\">Running Tests<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We have defined integration tests using <a href=\"https:\/\/jestjs.io\/\">jest<\/a> for all the API end points. The integration tests use the same database configuration as the application. After the tests, the documents are cleaned up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tests are configured in the <code>__test__<\/code> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To run the tests, create a copy of <code>config\/test.env.example<\/code> file and rename it to <code>config\/test.env<\/code> and add the values for the Couchbase connection.<\/p>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code># Execute this command in the project&#039;s root directory\nnpm run test\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-appendix\" class=\"wp-block-heading\">Appendix<\/h3>\n\n\n\n<h4 id=\"h-extending-api-by-adding-new-entity\" class=\"wp-block-heading\">Extending API by Adding New Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you would like to add another entity to the APIs, these are the steps to follow:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p><strong>Create the New Entity in Couchbase Bucket:<\/strong><\/p>\n<ul>\n<li>Utilize the <a href=\"https:\/\/docs.couchbase.com\/cloud\/n1ql\/n1ql-language-reference\/createcollection.html\">Couchbase Server interface<\/a> to establish the new collection within the Couchbase bucket.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p><strong>Define the New Route:<\/strong><\/p>\n<ul>\n<li>Navigate to the <code>src\/routes<\/code> folder and create the new route.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p><strong>Controller Configuration:<\/strong><\/p>\n<ul>\n<li>Develop a new file in the <code>controllers<\/code> folder, mirroring the existing structures (e.g., <code>airportController.js<\/code>). Craft the corresponding method within this file to manage the new entity.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p><strong>Add Tests:<\/strong><\/p>\n<ul>\n<li>Add the tests for the new routes in a new file in the <code>__test__<\/code> folder similar to other collection tests.<\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Following these steps ensures a systematic and organized approach to expanding the API functionality with a new entity.<\/p>\n\n\n\n<h4 id=\"h-running-self-managed-couchbase-cluster\" class=\"wp-block-heading\">Running Self Managed Couchbase Cluster<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you are running this quickstart with a self managed Couchbase cluster, you need to <a href=\"https:\/\/docs.couchbase.com\/server\/current\/manage\/manage-settings\/install-sample-buckets.html\">load<\/a> the travel-sample data bucket in your cluster and generate the credentials for the bucket.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Follow <a href=\"\/tutorial-couchbase-installation-options\">Couchbase Installation Options<\/a> for installing the latest Couchbase Database Server Instance.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You need to update the connection string and the credentials in the <code>dev.env<\/code> file in the <code>config<\/code> folder.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: Couchbase Server must be installed and running prior to running the app.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-swagger-documentation\" class=\"wp-block-heading\">Swagger Documentation<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documentation provides a clear view of the API including endpoints, HTTP methods, request parameters, and response objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click on an individual endpoint to expand it and see detailed information. This includes the endpoint&#8217;s description, possible response status codes, and the request parameters it accepts.<\/p>\n\n\n\n<h5 id=\"h-trying-out-the-api\" class=\"wp-block-heading\">Trying Out the API<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">You can try out an API by clicking on the &#8220;Try it out&#8221; button next to the endpoints.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Parameters: If an endpoint requires parameters, Swagger UI provides input boxes for you to fill in. This could include path parameters, query strings, headers, or the body of a POST\/PUT request.<\/p>\n<\/li>\n\n\n<li>\n<p>Execution: Once you&#8217;ve inputted all the necessary parameters, you can click the &#8220;Execute&#8221; button to make a live API call. Swagger UI will send the request to the API and display the response directly in the documentation. This includes the response code, response headers, and response body.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<h5 id=\"h-models\" class=\"wp-block-heading\">Models<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documents the structure of request and response bodies using models. These models define the expected data structure using JSON schema and are extremely helpful in understanding what data to send and expect.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to connect to a Couchbase cluster using Ottoman JS instead of the NodeJS SDK to create, read, update, and delete documents, and write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Ottoman [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[653],"tutorial-tags":[663,662,546],"tutorial-technologies":[559],"tutorial-types":[550],"class_list":["post-10366","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-nodejs","tutorial-tags-express","tutorial-tags-ottoman","tutorial-tags-rest-api","tutorial-technologies-connectors","tutorial-types-quickstart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using Ottoman.js and Express - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Ottoman.js and Express\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to connect to a Couchbase cluster using Ottoman JS instead of the NodeJS SDK to create, read, update, and delete documents, and write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Ottoman [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"16\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/developers\\\/tutorials\\\/quickstart-ottomanjs\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/developers\\\/tutorials\\\/quickstart-ottomanjs\\\/\",\"name\":\"Using Ottoman.js and Express - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#website\"},\"datePublished\":\"2024-02-02T11:36:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/developers\\\/tutorials\\\/quickstart-ottomanjs\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/de\\\/developers\\\/tutorials\\\/quickstart-ottomanjs\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/developers\\\/tutorials\\\/quickstart-ottomanjs\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Ottoman.js and Express\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Ottoman.js and Express - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/","og_locale":"de_DE","og_type":"article","og_title":"Using Ottoman.js and Express","og_description":"In this tutorial, you will learn how to connect to a Couchbase cluster using Ottoman JS instead of the NodeJS SDK to create, read, update, and delete documents, and write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Ottoman [&hellip;]","og_url":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"16\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/","url":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/","name":"Using Ottoman.js and Express - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/de\/#website"},"datePublished":"2024-02-02T11:36:21+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/de\/developers\/tutorials\/quickstart-ottomanjs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Using Ottoman.js and Express"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/de\/#website","url":"https:\/\/www.couchbase.com\/de\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/de\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/de\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.couchbase.com\/de\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase ist ein in San Jose, Kalifornien, ans\u00e4ssiges Unternehmen f\u00fcr Datenbanksoftware, das eine operative Datenplattform f\u00fcr KI bereitstellt, die von Hunderten von globalen Unternehmen eingesetzt wird.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorials\/10366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorials\/10366\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/media?parent=10366"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorial-languages?post=10366"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorial-tags?post=10366"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorial-technologies?post=10366"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/de\/wp-json\/wp\/v2\/tutorial-types?post=10366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}