{"id":10279,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/android-kotlin-query-sql\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"android-kotlin-query-sql","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/","title":{"rendered":"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose"},"content":{"rendered":"\n<h3 id=\"h-introduction\" class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Couchbase Mobile supports SQL++ query strings using the SQL++ Query API.  SQL++ is Couchbase\u2019s declarative query language that extends SQL for JSON. The structure and semantics of the query format are based on that of Couchbase Server\u2019s SQL++ query language\u2009\u2014\u2009see <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/index.html\">N1QL Reference Guide<\/a> and <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/data\/n1ql-versus-sql.html\">N1QL Data Model<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this step of the learning path you will learn the fundamentals of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Querying using SQL++ Strings<\/li>\n\n\n<li>Using Live Queries with queryChangeFlow and Kotlin Co-Routine Flows using Live Data and Mutable Live Data<\/li>\n\n\n<li>Using JSON Serialization to &#8220;deserialize&#8221; documents from the database in to Kotlin data class<\/li>\n\n\n<li>Using indexes to speed up a query<\/li>\n\n\n<li>Using the count function with the QueryBuilder API<\/li>\n\n\n<li>Using the LIKE operator to search for documents with a specific value in a field<\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-app-overview\" class=\"wp-block-heading\">App Overview<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">While the demo app has a lot of functionality, this step will walk you through:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in into the application<\/li>\n\n\n<li>Selecting a project from the list of projects<\/li>\n\n\n<li>Scrolling the list of stock items audited<\/li>\n\n\n<li>Review the code for displaying stock items that have been audited<\/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\"><strong>NOTE<\/strong>:  This step assumes you completed the previous step <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"android-kotlin-batch-operations?learningPath=learn\/android-kotlin\"><code>Batch operations<\/code><\/a> that loaded the sample data into the application.  This part of the learning path will not work if you don&#8217;t complete the previous steps.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-installation\" class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<h4 id=\"h-fetching-app-source-code\" class=\"wp-block-heading\">Fetching App Source Code<\/h4>\n\n\n\n<h5 id=\"h-clone-source-code\" class=\"wp-block-heading\">Clone Source Code<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you haven&#8217;t already cloned the repo from the previous steps, clone the <code>Learn Couchbase Lite with Kotlin and Jetpack Compose<\/code> repository from GitHub.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>git clone https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-try-it-out\" class=\"wp-block-heading\">Try it out<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open src\/build.gradle using Android Studio.<\/li>\n\n\n<li>Build and run the project.<\/li>\n\n\n<li>Log in to the app with  <strong><em>&#8220;<a href=\"mailto:demo@example.com\">demo@example.com<\/a>&#8220;<\/em><\/strong> and <strong><em>&#8220;P@ssw0rd12&#8221;<\/em><\/strong> for user Id and password fields respectively.<\/li>\n\n\n<li>Verify that you see sample projects on the screen.  Tapping on a Project will bring up the audit inventory counts for that project.<\/li>\n\n\n<li>If you do not see sample projects and inventory audits, please complete the previous step <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"android-kotlin-batch-operations?learningPath=learn\/android-kotlin\"><strong>Batch operations<\/strong><\/a> to load sample data before continuing.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"audit_listing.gif\" alt=\"Audit Listing,400\"><\/p>\n\n\n\n<h4 id=\"h-the-audit-document\" class=\"wp-block-heading\">The Audit Document<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The sample app was loaded with a collection of <code>Document<\/code> with a <em>&#8220;type&#8221;<\/em> property of <em>&#8220;audit&#8221;<\/em> in the previous sections of the learning path.  Each document represents a item that that a team would would record with how many of those items they found in the warehouse while working on a project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a document would be:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n\t&quot;team&quot;: &quot;team1&quot;,\n\t&quot;modifiedOn&quot;: &quot;1656804470003&quot;,\n\t&quot;documentType&quot;: &quot;audit&quot;,\n\t&quot;createdBy&quot;: &quot;demo@example.com&quot;,\n\t&quot;modifiedBy&quot;: &quot;demo@example.com&quot;,\n\t&quot;projectId&quot;: &quot;c4a8fbac-083a-4ad5-87e5-2fe1c03a3689&quot;,\n\t&quot;createdOn&quot;: &quot;1656804470003&quot;,\n\t&quot;auditId&quot;: &quot;d3fb4d2e-0c75-4a85-b9b9-418a3b5f8303&quot;,\n\t&quot;notes&quot;: &quot;Found item Langres Psion Ale - Sweet Ale with Langres flavors in warehouse&quot;,\n\t&quot;auditCount&quot;: 42330,\n\t&quot;stockItem&quot;: {\n\t\t&quot;name&quot;: &quot;Langres Psion Ale&quot;,\n\t\t&quot;description&quot;: &quot;Sweet Ale with Langres flavors&quot;,\n\t\t&quot;itemId&quot;: &quot;e53dddf3-2058-4963-9293-66a87c84b29b&quot;,\n\t\t&quot;price&quot;: 52.76,\n    &quot;style&quot;: &quot;Imperial Stout&quot;\n\t}\n}\n<\/code><\/pre>\n\n\n\n<h5 id=\"h-the-audit-data-class\" class=\"wp-block-heading\">The Audit Data Class<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">When a <em>&#8220;audit&#8221;<\/em> item is retreived from the database it is stored within an data class of type <strong>Audit<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>@Keep\n@Serializable\n@ExperimentalSerializationApi\ndata class Audit (\n    var auditId: String = &quot;&quot;,\n    var projectId: String = &quot;&quot;,\n    var stockItem: StockItem? = null,\n    var auditCount: Int = 0,\n    var documentType: String = &quot;&quot;,\n    var notes: String = &quot;&quot;,\n    \/\/security tracking\n    var team: String = &quot;&quot;,\n    var createdBy: String = &quot;&quot;,\n    var modifiedBy: String = &quot;&quot;,\n    @Serializable(with = DateSerializer::class)\n    var createdOn: Date? = null,\n    @Serializable(with = DateSerializer::class)\n    var modifiedOn: Date? = null\n)\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-exploring-the-sql-query-string-api-with-the-count-function\" class=\"wp-block-heading\">Exploring the SQL++ Query String API with the Count Function<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The SQL++ Query String API in Couchbase Lite is extensive.  On the Developer &#8211; Database Information screen we display the number of audit documents found in the inventory database.  The <code>SQL++ Query String<\/code> API along with the count function was used to calculate this number.  To see the Developer Information screen:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Launch the Invenory Application on your emulator<\/li>\n\n\n<li>Login in using the username <em><a href=\"mailto:demo@example.com\">demo@example.com<\/a><\/em> and password <em>P@ssw0rd12<\/em><\/li>\n\n\n<li>Click the Drawer menu icon (sometimes referred to the Hamburger icon) and tap on Developer<\/li>\n\n\n<li>Tap on the Database Information button<\/li>\n\n<\/ul>\n\n\n\n<h4 id=\"h-counting-number-of-documents-by-type\" class=\"wp-block-heading\">Counting number of documents by type<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;DevDatabaseInfoView&#8221; screen displays the count of how many documents are in the inventory database with the type set to &#8216;audit&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"dev_info_audit_count.png\" alt=\"Developer - Database Information\" title=\"#width=400px\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The DevDatabaseInfoView function obtains this information from the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/ui\/developer\/DevDatabaseInfoViewModel.kt#L107\"> <strong>DevDatabaseInfoViewModel<\/strong><\/a> class, which tracks this in a mutableStateOf variable.   The view model calls the AuditRepositoryDb which runs the query to calculate the count.<\/p>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>private suspend fun updateAuditCount() {\n  viewModelScope.launch(Dispatchers.IO) {\n   val auditCount = auditRepository.count()\n    if (auditCount &gt; 0) {\n     withContext(Dispatchers.Main) {\n      numberOfAudits.value = auditCount\n      }\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/audits\/AuditRepositoryDb.kt#L154\"> <strong>AuditRepositoryDb.kt<\/strong><\/a> file and locate the <code>count<\/code> function.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>override suspend fun count(): Int {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We build the Query using the <code>SQL++ Query String<\/code> API that will look for Documents that match the specified criteria.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>var count = 0\ntry {\n    val db = DatabaseManager.getInstance(context).inventoryDatabase\n    db?.let { database -&gt;\n\n        val query =  database.createQuery(&quot;SELECT COUNT(*) \n        AS count FROM _ AS item WHERE \n        documentType=&quot;audit&quot;&quot;) \/\/ 1\n        \n        val results = query.execute().allResults() \/\/ 2\n        count = results[0].getInt(&quot;count&quot;) \/\/ 3\n    }\n} catch (e: Exception) {\n    Log.e(e.message, e.stackTraceToString())\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Call the database API to create a Query using the createQuery function and passing in a string<\/li>\n\n\n<li>We run the Query by calling the <code>execute().allResults()<\/code> method on the Query that was constructed in the previous step<\/li>\n\n\n<li>We get the results by looking at the first result in the collection and getting an integer value for the key &#8220;count&#8221; which we defined in the <code>SELECT<\/code> clause<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-futher-exploring-the-sql-query-string-api\" class=\"wp-block-heading\">Futher Exploring the SQL++ Query String API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are several minor but notable behavior differences between SQL++ for Mobile queries and N1QL for Server.  More information on the differences can be found in the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-n1ql-mobile-server-diffs.html\">SQL++ Server Differences<\/a> documentation. In our example, we will be using the API to make a simple <em>pattern matching<\/em> query using the equalTo operator.  This example will use Live Query with Kotlin coroutine flows and live data.<\/p>\n\n\n\n<h4 id=\"h-fetching-audit-documents\" class=\"wp-block-heading\">Fetching Audit Documents<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">From the &#8220;Login&#8221; screen, when a user logs in with the proper credentials they are presented with a list of projects there team is assigned to work on.  From the project listing when a user taps on a project they are presented with a listing of audit items that was recorded as inventory items at the location of the project.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/ui\/audit\/AuditListView.kt#L58\"> <strong>AuditListView.kt<\/strong><\/a> file and locate the <code>AuditListView<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>The live query is converted from Live Data to state by calling the observeAsState function call on the Live Data list of audits provided by the view model.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>val audits = viewModel.audits.observeAsState()\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To see how the live data list is created, open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/ui\/audit\/AuditListViewModel.kt#L39\"> <strong>AuditListViewModel.kt<\/strong><\/a> file and locate the <code>getAudits<\/code> function.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>viewModelScope.launch(Dispatchers.IO) {\n  _auditFlow = auditRepository.getAuditsByProjectId(project.projectId)\n  _auditFlow?.let {  f -&gt;\n    f.collect {\n      _audits.postValue(it)\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>The view model exposes the live data which is a list of audits from the repository getAuditsByProjectId function.  Since the repository returns a flow the flow must be unboxed and then collected with the results added to the live data by calling the postValue function.<\/p>\n<\/li>\n\n\n<li>\n<p>The getAuditsByProjectId function takes in the project&#8217;s projectId in order to filter out results to only the audits associated with that project.<\/p>\n<\/li>\n\n\n<li>\n<p>To see how to build the flow, open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/audits\/AuditRepositoryDb.kt#L30\"> <strong>AuditRepositoryDb.kt<\/strong><\/a> file and locate the getAuditsByProjectId function.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>override fun getAuditsByProjectId(projectId: String): Flow&lt;List&lt;Audit&gt;&gt;? { \n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We first build a Query using the databases createQuery function that takes in a SQL++ query.  Notice how parameter names start with a dollar sign and the dollar sign must be escaped with a .<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>val query = database.createQuery(&quot;SELECT * FROM _ AS item WHERE type=&quot;audit&quot; AND projectId=$auditProjectId AND team=$auditTeam&quot;) \/\/ 1\n\nval parameters = Parameters() \/\/ 2\nparameters.setValue(&quot;auditProjectId&quot;, projectId) \/\/ 2\nparameters.setValue(&quot;auditTeam&quot;, team) \/\/ 2\n\nquery.parameters = parameters \/\/ 3\n\nval flow = query \/\/ 4\n  .queryChangeFlow() \/\/ 5\n  .map { qc -&gt; mapQueryChangeToAudit(qc)} \/\/ 6\n  .flowOn(Dispatchers.IO) \/\/ 7\n\nquery.execute() \/\/ 8\nreturn flow \/\/ 9\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Build a query using the databases <code>createQuery<\/code> function<\/li>\n\n\n<li>Create a paramters collection to store the parameters in.  Add the parameters and there values to the collection.<\/li>\n\n\n<li>Set the query parameters property to the parameter collection.<\/li>\n\n\n<li>Define a flow<\/li>\n\n\n<li>Use the queryChangeFlow function to return a flow<\/li>\n\n\n<li>The <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/developer.android.com\/kotlin\/flow#modify\">intermediate operator map<\/a> is used to change the results coming back using the mapQueryChangeToAudit function passing in the QueryChange.  This is used to deserialize the results from JSON to the Audit data class.<\/li>\n\n\n<li>The flowOn function is used to make sure that the flow runs on the Dispatcher.IO context to keep the code from running on the main UI thread.<\/li>\n\n\n<li>The query executes.  Remember this step <strong>MUST<\/strong> be done before returning the flow.<\/li>\n\n\n<li>Return the flow<\/li>\n\n<\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>REMINDER<\/strong>:  Kotlin Co Routine Flows emit new values into the stream of data and are not returned until they are <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/developer.android.com\/kotlin\/flow\">collected<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<h5 id=\"h-indexing-the-query\" class=\"wp-block-heading\">Indexing the Query<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Creating indexes for non-FTS based queries is optional. However, to speed up queries, you can create indexes on the properties that you would query against. Indexing is handled eagerly.<\/p>\n<\/li>\n\n\n<li>\n<p>In the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/DatabaseManager.kt#L186\"><strong>DatabaseManager.kt<\/strong><\/a>  file, locate the <code>createAuditIndex<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>We create an index on the <code>type<\/code>, <code>projectId<\/code>, and <code>team<\/code> properties of the documents in the <em>inventory<\/em> database.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>private fun createAuditIndex(){\n try {\n  inventoryDatabase?.let {  \/\/ 1\n   if (!it.indexes.contains(auditIndexName)) {\n    \/\/ create index for Audits to return documents with\n    \/\/ the type attribute set to audit, the projectId filtered\n    \/\/ by value sent in using equals, and the team attribute filtered\n    \/\/ by the value sent in using equals\n\n    it.createIndex( \/\/ 3\n     auditIndexName, \/\/ 4\n     IndexBuilder.valueIndex(   \/\/ 5\n      ValueIndexItem.property(typeAttributeName), \/\/ 5\n      ValueIndexItem.property(projectIdAttributeName), \/\/ 5\n      ValueIndexItem.property(teamAttributeName)) \/\/ 5\n      )\n    }\n   }\n  } catch (e: Exception){\n    android.util.Log.e(e.message, e.stackTraceToString())\n  }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The let keyword is used to unbox the database since it can be null.<\/li>\n\n\n<li>Call the database createIndex function which takes in a name of the index and then the properites to index<\/li>\n\n\n<li>The name of the index in string format.  auditIndexName is defined toward the top of the class with the value <code>idxAudit<\/code><\/li>\n\n\n<li>The IndexBuilder&#8217;s valueIndex function can be used to create the index<\/li>\n\n\n<li>The ValueIndexItem.property factory method can be used to create a ValueIndexItem by passing in the property of which to index.<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-sql-query-string-api-searching-for-stock-items-with-the-like-operator\" class=\"wp-block-heading\">SQL++ Query String API &#8211; Searching for Stock Items with the LIKE Operator<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The SQL ++ Query String API supports serveral operators including the LIKE which can be used for string matching.  We use the LIKE operator on the data editor screen for audits to find a stock item to add to a audit.  Let&#8217;s review the code.<\/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\"><strong>NOTE<\/strong>: The like operator performs case sensitive matches.  To perform case insensitive matching, use lowercase or uppercase functions to ensure all comparators have the same case, thereby removing the case issue.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">On the Audit Editor screen we provide a link to the Stock Item Section screen.  To see the Audit Editor screen:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Launch the Invenory Application on your emulator<\/li>\n\n\n<li>Login in using the username <em><a href=\"mailto:demo@example.com\">demo@example.com<\/a><\/em> and password <em>P@ssw0rd12<\/em><\/li>\n\n\n<li>Tap on one of the Projects to bring up the Audit List screen<\/li>\n\n\n<li>Tap the + button to add a new audit<\/li>\n\n\n<li>Tap the button <code>No Stock Item Selected<\/code><\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"audit_editor_screen_noitem_selected.png\" alt=\"Project Editor screen\" title=\"#width=300px\"><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the Name box enter ipa<\/li>\n\n\n<li>In the Description box enter wicked<\/li>\n\n\n<li>Hit the Search button<\/li>\n\n\n<li>A listing of stock items should return that match these results<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"select_audit_stockitem.png\" alt=\"Select Stock Item screen\" title=\"#width=300px\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s review the code for the Stock Item Section screen.<\/p>\n\n\n\n<h4 id=\"h-stock-item-selection\" class=\"wp-block-heading\">Stock Item Selection<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/ui\/audit\/StockItemSelectionView.kt#L46\"> <strong>StockItemSelectionView.kt<\/strong><\/a> file and locate the <code>StockItemSelectionView<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>The StockItemSelectionView exposes the viewModel&#8217;s onSearch which the StockItemSelector function uses with the Search button.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>StockItemSelector(\n  searchName = viewModel.searchName.value,\n  searchDescription = viewModel.searchDescription.value,\n  onSearchNameChanged = viewModel.onSearchNameChanged,\n  onSearchDescriptionChanged = viewModel.onSearchDescriptionChanged,\n  onSearch = viewModel.onSearch,\n  stockItemStatusMessage = viewModel.statusMessage.value,\n  stockItems = viewModel.stockItemsState,\n  onStockItemSelected = onStockItemSelected\n)\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is defined as OnSearch in the StockItemSelector function<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>fun StockItemSelector(\n    searchName: String,\n    searchDescription: String,\n    onSearchNameChanged: (String) -&gt; Unit,\n    onSearchDescriptionChanged: (String) -&gt; Unit,\n    onSearch: () -&gt; Unit,\n    stockItemStatusMessage: String,\n    stockItems: List&lt;StockItem&gt;,\n    onStockItemSelected: (StockItem) -&gt; Unit)\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The search button then calls the OnSearch method on the OnClick listener.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>Button(modifier = Modifier\n  .padding(top = 4.dp),\n  colors = ButtonDefaults.buttonColors(backgroundColor = Red500),\n  onClick = {\n      onSearch()\n  })\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/main\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/ui\/audit\/StockItemSelectionViewModel.kt#L45\"> <strong>StockItemSelectionViewModel.kt<\/strong><\/a> file and locate the <code>onSearch<\/code> val definition.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>val onSearch: () -&gt; Unit = {\n viewModelScope.launch {  \/\/ &lt;1&gt;\n  if (searchName.value.length &gt;= 2) { \/\/ &lt;2&gt;\n   isLoading.value = true\n   val foundItems = stockItemRepository\n    .getByNameDescription(searchName.value, searchDescription.value) \/\/ &lt;3&gt;\n   if (foundItems.isNotEmpty()) { \/\/ &lt;4&gt;\n    withContext(Dispatchers.Main) {\n     stockItemsState.clear()\n     stockItemsState.addAll(foundItems)\n     isLoading.value = false\n    } \n   } else { \/\/ &lt;5&gt;\n    withContext(Dispatchers.Main) {\n     stockItemsState.clear()\n     statusMessage.value = &quot;No stock items Found&quot;\n     isLoading.value = false\n    }\n   }\n  }\n }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Since we will be talking to the database using suspend functions, we want to make sure we use viewModel Scope<\/li>\n\n\n<li>Business logic to check if the searchName value is greater than or equal to 2 characters.  If so, then we can search for stock items.<\/li>\n\n\n<li>Call the stockItemRepository getByNameDescription function which takes in the searchName and searchDescription values.<\/li>\n\n\n<li>If the stock item list is not empty, then we can set the stockItemsState to the stock item list.<\/li>\n\n\n<li>If not, then we set the statusMessage to &#8220;No stock items Found&#8221;.<\/li>\n\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/android-kotlin-cbl-learning-path\/blob\/devadv-2050\/src\/app\/src\/main\/java\/com\/couchbase\/learningpath\/data\/stockItem\/StockItemRepositoryDb.kt#L64\"> <strong>StockItemRepositoryDb.kt<\/strong><\/a> file and locate the <code>getByNameDescription<\/code> function.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>override suspend fun getByNameDescription(\n    searchName: String,\n    searchDescription: String?\n): List&lt;StockItem&gt; {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We wil use withContext(Dispatchers.IO) to make sure we are working on the IO thread since we will be talking to the database.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>val stockItems = mutableListOf&lt;StockItem&gt;()\ntry {\n val db = databaseResources.warehouseDatabase\n db?.let { database -&gt;\n  var queryString = &quot;SELECT * FROM _ as item WHERE \n  documentType=&quot;item&quot; AND lower(name) LIKE (&#039;%&#039; || \n  $parameterName || &#039;%&#039;)&quot;  \/\/ 1\n  var parameters = Parameters() \/\/ 2\n  parameters.setString(&quot;parameterName&quot;, searchName.lowercase()) \/\/ 3\n  searchDescription?.let { description -&gt;\n   if (description.isNotEmpty()) {  \/\/ 4\n    queryString =\n    queryString.plus(&quot; AND lower(description) LIKE (&#039;%&#039; || $parameterDescription || &#039;%&#039;)&quot;)  \/\/ 5\n    parameters.setString(\n     &quot;parameterDescription&quot;,\n     searchDescription.lowercase()\n    ) \/\/ 6\n   }\n   var query = database.createQuery(queryString) \/\/ 7\n   query.parameters = parameters \/\/ 8\n   var results = query.execute().allResults() \/\/ 9\n   results.forEach { result -&gt;  \/\/ 10\n    val stockItem = Json.decodeFromString&lt;StockItemDao&gt;(result.toJSON()).item \/\/ 11\n    stockItems.add(stockItem) \/\/ 12\n    }\n   }\n }\n} catch (e: java.lang.Exception) {\n Log.e(e.message, e.stackTraceToString())\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a SQL++ query off the name attribute and use the like function with a defined parameter labeled parameterName.  This is used to stop SQL injection bugs.<\/li>\n\n\n<li>Create a Parameters object.<\/li>\n\n\n<li>Add the parameterName to the Parameters object using the searchName varible passed in and making sure it&#8217;s lowercase.<\/li>\n\n\n<li>If the searchDescrpition value is not null<\/li>\n\n\n<li>We append the query and add the like function to the query filtering out the description attribute using the parameterDescription label.<\/li>\n\n\n<li>Add the parameterDescription to the Parameters object using the searchDescription varible passed in and making sure it&#8217;s lowercase.<\/li>\n\n\n<li>Create a query using the queryString<\/li>\n\n\n<li>Add the parameters to the query<\/li>\n\n\n<li>Excute the query using the Query API to select all the results<\/li>\n\n\n<li>Loop through all the results found in the database<\/li>\n\n\n<li>Decode the result to a StockItemDao object and set it to the stockItem variable<\/li>\n\n\n<li>Add the stockItem to the stockItems list<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-learn-more\" class=\"wp-block-heading\">Learn More<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations on completing this step of our learning path!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This step of the learning path walked you through the SQL++ Query API in Couchbase Lite and used it to return documents from the database using serveral methods. Check out the following links for further documenation and continue on to the next step to learn more about how to setup Couchbase Server and Sync Gateway with Docker and Docker Compose.<\/p>\n\n\n\n<h4 id=\"h-references\" class=\"wp-block-heading\">References<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-n1ql-mobile.html\">Documentation: SQL++ Query Strings<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-n1ql-mobile.html#purpose-21\">Documentation: SQL++ Query Strings &#8211; Comparision Operators<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-n1ql-mobile.html#lbl-functions\">Documentation: SQL++ Query Strings &#8211; Functions<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-n1ql-mobile-server-diffs.html\">Documentation: SQL++ Differences<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-resultsets.html\">Documentation: Result Sets<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-live.html\">Documentation: Live Query &#8211; Working with Queries<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-troubleshooting.html\">Documentation: Query Troubleshooting\n<\/a><\/li>\n\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Couchbase Mobile supports SQL++ query strings using the SQL++ Query API. SQL++ is Couchbase\u2019s declarative query language that extends SQL for JSON. The structure and semantics of the query format are based on that of Couchbase Server\u2019s SQL++ query language\u2009\u2014\u2009see N1QL Reference Guide and N1QL Data Model. In this step of the learning path [&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":[586],"tutorial-tags":[587,574],"tutorial-technologies":[585],"tutorial-types":[555],"class_list":["post-10279","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-kotlin","tutorial-tags-android","tutorial-tags-sql-n1ql","tutorial-technologies-mobile","tutorial-types-tutorial"],"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>Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose - 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\/it\/developers\/tutorials\/android-kotlin-query-sql\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose\" \/>\n<meta property=\"og:description\" content=\"Introduction Couchbase Mobile supports SQL++ query strings using the SQL++ Query API. SQL++ is Couchbase\u2019s declarative query language that extends SQL for JSON. The structure and semantics of the query format are based on that of Couchbase Server\u2019s SQL++ query language\u2009\u2014\u2009see N1QL Reference Guide and N1QL Data Model. In this step of the learning path [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/\" \/>\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=\"13 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/android-kotlin-query-sql\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/android-kotlin-query-sql\\\/\",\"name\":\"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/android-kotlin-query-sql\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/android-kotlin-query-sql\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/android-kotlin-query-sql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/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\\\/it\\\/#\\\/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":"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose - 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\/it\/developers\/tutorials\/android-kotlin-query-sql\/","og_locale":"it_IT","og_type":"article","og_title":"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose","og_description":"Introduction Couchbase Mobile supports SQL++ query strings using the SQL++ Query API. SQL++ is Couchbase\u2019s declarative query language that extends SQL for JSON. The structure and semantics of the query format are based on that of Couchbase Server\u2019s SQL++ query language\u2009\u2014\u2009see N1QL Reference Guide and N1QL Data Model. In this step of the learning path [&hellip;]","og_url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/","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":"13 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/","url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/","name":"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/it\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/android-kotlin-query-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Learn Couchbase Lite SQL++ Querying with Kotlin and Jetpack Compose"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/it\/#website","url":"https:\/\/www.couchbase.com\/it\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/it\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/it\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.couchbase.com\/it\/#\/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\/it\/#\/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 \u00e8 una societ\u00e0 di software per database con sede a San Jose, in California, che fornisce una piattaforma operativa per i dati utilizzata da centinaia di aziende globali.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10279\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/media?parent=10279"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-languages?post=10279"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-tags?post=10279"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-technologies?post=10279"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-types?post=10279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}