{"id":2487,"date":"2017-01-09T15:00:00","date_gmt":"2017-01-09T15:00:00","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2487"},"modified":"2025-06-13T20:15:29","modified_gmt":"2025-06-14T03:15:29","slug":"querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/","title":{"rendered":"Consulta de documentos Couchbase en una aplicaci\u00f3n NativeScript Angular Mobile"},"content":{"rendered":"<p>I <a href=\"https:\/\/www.couchbase.com\/blog\/key-value-operations-in-couchbase-mobile-via-nativescript-and-angular\/\">recently wrote about<\/a> using Couchbase as a key-value store in a NativeScript iOS and Android application built with Angular. In this example we saw how to collect user profile information to be saved or loaded from <a href=\"https:\/\/www.couchbase.com\">Couchbase<\/a> on the mobile devices. However, we were saving and loading based on a particular key, not querying based on document properties.<\/p>\n<p>What if you have NoSQL documents where you don&#8217;t know the key and you need to query based on the document properties? In this example we&#8217;re going to take the <a href=\"https:\/\/www.couchbase.com\/blog\/key-value-operations-in-couchbase-mobile-via-nativescript-and-angular\/\">previous article<\/a> to the next level.<\/p>\n<div class=\"figure\"><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2017\/january\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/ns-couchbase-profiles-p2.gif\" alt=\"NativeScript with Couchbase Profiles Example\" \/><\/div>\n<p>We&#8217;re going to bring our single page <a href=\"https:\/\/www.nativescript.org\">NativeScript<\/a> application to multiple pages where the first page is a list of previously saved profiles and the second page allows you to create new profiles. Navigation between the pages will happen with the Angular Router.<\/p>\n<h2 id=\"the-requirements\">The Requirements<\/h2>\n<p>The requirements between this guide and the previous remain the same. You&#8217;ll need the following:<\/p>\n<ul>\n<li>NativeScript CLI 2.0+<\/li>\n<li>Android SDK and \/ or Xcode for Mac<\/li>\n<\/ul>\n<p>The NativeScript CLI which is obtained through the Node Package Manager (NPM) will allow us to create and build mobile projects. To build and deploy actual Android and iOS applications you&#8217;ll need either the Android SDK or Xcode or both.<\/p>\n<h2 id=\"starting-from-where-we-left-off\">Starting From Where We Left Off<\/h2>\n<p>We won&#8217;t be building our project from scratch, but instead we&#8217;ll be referencing the <a href=\"https:\/\/www.couchbase.com\/blog\/key-value-operations-in-couchbase-mobile-via-nativescript-and-angular\/\">previous NativeScript with Couchbase tutorial<\/a>. However, a lot of what you see here will be a review.<\/p>\n<p>The previous project should be a basic one page application with the <a href=\"https:\/\/www.github.com\/couchbaselabs\/nativescript-couchbase\">nativescript-couchbase<\/a> plugin installed. We need to bring our single page into multiple pages.<\/p>\n<h2 id=\"preparing-multiple-application-pages-for-navigation\">Preparing Multiple Application Pages for Navigation<\/h2>\n<p>We will be using two pages in addition to the modal that we had previously created. Within your project, create the following files and directories:<\/p>\n<pre><code>app\/components\/profile-list\/\r\napp\/components\/profile-list\/profile-list.ts\r\napp\/components\/profile-list\/profile-list.html\r\napp\/components\/profile\/\r\napp\/components\/profile\/profile.ts\r\napp\/components\/profile\/profile.html<\/code><\/pre>\n<p>The above files will represent our two pages. To be successful with the Angular Router we need to create a routing file that links these files together.<\/p>\n<p>Create the following within your project:<\/p>\n<pre><code>app\/app.routing.ts<\/code><\/pre>\n<p>While we haven&#8217;t created our page classes yet, we&#8217;re going to focus on linking them together. Open the project&#8217;s <strong>app\/app.routing.ts<\/strong> file and include the following:<\/p>\n<pre><code>import { ProfileListComponent } from \".\/components\/profile-list\/profile-list\";\r\nimport { ProfileComponent } from \".\/components\/profile\/profile\";\r\n\r\nexport const appRoutes: any = [\r\n    { path: \"\", component: ProfileListComponent },\r\n    { path: \"profile\", component: ProfileComponent }\r\n];\r\n\r\nexport const appComponents: any = [\r\n    ProfileListComponent,\r\n    ProfileComponent\r\n];<\/code><\/pre>\n<p>As you can guess we&#8217;re going to have a <code>ProfileListComponent<\/code> and a <code>ProfileComponent<\/code>. When it comes to <code>appRoutes<\/code>, the default page is the one with an empty route path. The second page will be navigate-able via the <code>profile<\/code> path.<\/p>\n<p>Adding each of the components to an array is a convenience for the next step.<\/p>\n<p>Open the project&#8217;s <strong>app\/app.module.ts<\/strong> file because we need to configure the router to use the routing file we had just created.<\/p>\n<pre><code>import { NgModule, NO_ERRORS_SCHEMA } from \"@angular\/core\";\r\nimport { NativeScriptModule } from \"nativescript-angular\/platform\";\r\nimport { NativeScriptFormsModule } from \"nativescript-angular\/forms\";\r\nimport { NativeScriptRouterModule } from \"nativescript-angular\/router\";\r\nimport { ModalDialogService } from \"nativescript-angular\/modal-dialog\";\r\n\r\nimport { appComponents, appRoutes } from \".\/app.routing\";\r\nimport { AppComponent } from \".\/app.component\";\r\nimport { ModalComponent } from \".\/app.modal\";\r\n\r\n@NgModule({\r\n    declarations: [AppComponent, ModalComponent, ...appComponents],\r\n    entryComponents: [ModalComponent],\r\n    bootstrap: [AppComponent],\r\n    imports: [\r\n        NativeScriptModule,\r\n        NativeScriptFormsModule,\r\n        NativeScriptRouterModule,\r\n        NativeScriptRouterModule.forRoot(appRoutes)\r\n    ],\r\n    providers: [ModalDialogService],\r\n    schemas: [NO_ERRORS_SCHEMA]\r\n})\r\nexport class AppModule { }<\/code><\/pre>\n<p>Notice in the above that we still have all the modal related items from the previous tutorial. This time around we&#8217;ve imported from the <strong>app\/app.routing.ts<\/strong> file and injected into the <code>imports<\/code> and <code>declarations<\/code> array of the <code>@NgModule<\/code> block.<\/p>\n<p>The parent page for our routing system is the <code>AppComponent<\/code> class we were using in the previous example. We need to wipe it out.<\/p>\n<p>Open the project&#8217;s <strong>app\/app.component.html<\/strong> file and include the following XML markup:<\/p>\n<pre><code><\/code><\/pre>\n<p>To pair with this we can remove most of the code within the <strong>app\/app.component.ts<\/strong> file. This file should look similar to the following in the end:<\/p>\n<pre><code>import { Component } from \"@angular\/core\";\r\n\r\n@Component({\r\n    selector: \"my-app\",\r\n    templateUrl: \"app.component.html\",\r\n})\r\nexport class AppComponent { }<\/code><\/pre>\n<p>At this point we can start developing each of our application pages. For more information on routing using the Angular Router, visit a <a href=\"https:\/\/www.thepolyglotdeveloper.com\/2016\/10\/navigating-nativescript-app-angular-2-router\/\">previous article<\/a> I wrote on the subject.<\/p>\n<h2 id=\"moving-the-code-from-the-previous-couchbase-nativescript-example\">Moving the Code from the Previous Couchbase NativeScript Example<\/h2>\n<p>Remember all the code I just told you to wipe out? I probably shouldn&#8217;t have said that, but lucky for us you can copy and paste it from the previous example, or better yet, below.<\/p>\n<p>We need to take the code that was previously in the <strong>app\/app.component.ts<\/strong> and <strong>app\/app.component.html<\/strong> files and move it to the new <strong>app\/components\/profile\/profile.ts<\/strong> and <strong>app\/components\/profile\/profile.html<\/strong> files.<\/p>\n<p>Open the <strong>app\/components\/profile\/profile.html<\/strong> file and make it look like the following:<\/p>\n<pre><code>\r\n<label class=\"label\"><\/label>\r\n<label class=\"label\"><\/label>\r\n<button class=\"btn btn-primary w-full\"><\/button>\r\n<\/code><\/pre>\n<p>The only thing that has changed in the above is that I removed the button in the action bar that was used for loading data. Now open the project&#8217;s <strong>app\/components\/profile\/profile.ts<\/strong> file and include the following:<\/p>\n<pre><code>import { Component, ViewContainerRef } from \"@angular\/core\";\r\nimport { Location } from \"@angular\/common\";\r\nimport { ModalDialogService } from \"nativescript-angular\/directives\/dialogs\";\r\nimport { Couchbase } from \"nativescript-couchbase\";\r\nimport { ModalComponent } from \"..\/..\/app.modal\";\r\n\r\n@Component({\r\n    selector: \"profile\",\r\n    templateUrl: \".\/components\/profile\/profile.html\",\r\n})\r\nexport class ProfileComponent {\r\n\r\n    public profile: any;\r\n    private database: any;\r\n\r\n    public constructor(private modal: ModalDialogService, private vcRef: ViewContainerRef, private location: Location) {\r\n        this.profile = {\r\n            photo: \"~\/kitten1.jpg\",\r\n            firstname: \"\",\r\n            lastname: \"\"\r\n        }\r\n        this.database = new Couchbase(\"data\");\r\n    }\r\n\r\n    public showModal(fullscreen: boolean) {\r\n        let options = {\r\n            context: { promptMsg: \"Pick your avatar!\" },\r\n            fullscreen: fullscreen,\r\n            viewContainerRef: this.vcRef\r\n        };\r\n        this.modal.showModal(ModalComponent, options).then((res: string) =&gt; {\r\n            this.profile.photo = res || \"~\/kitten1.jpg\";\r\n        });\r\n    }\r\n\r\n    public save() {\r\n        this.database.createDocument(this.profile);\r\n        this.location.back();\r\n    }\r\n\r\n}<\/code><\/pre>\n<p>To be fair, I removed the <code>load<\/code> method that we had and included the Angular Location service for navigating backwards in the navigation stack. Everything, with the exception of paths, should be the same.<\/p>\n<p>Remember, my application has avatar images of kittens that I found on the internet.<\/p>\n<div class=\"figure\"><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2017\/january\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/cb-nativescript-kitten-pictures.jpg\" alt=\"NativeScript with Couchbase Kittens\" \/><\/div>\n<p>You should probably find your own avatar images and use them as appropriate. The <strong>~\/<\/strong> represents that the images should be found in the project&#8217;s <strong>app<\/strong> directory.<\/p>\n<p>Now we need to have a look at the yet to be created page for listing data on the screen.<\/p>\n<h2 id=\"querying-for-profiles-and-adding-them-to-a-list-on-the-ui\">Querying for Profiles and Adding Them to a List on the UI<\/h2>\n<p>Our new page should, in theory, be simpler than everything we&#8217;ve done so far and in the previous guide. Open the project&#8217;s <strong>app\/components\/profile-list\/profile-list.ts<\/strong> file and include the following:<\/p>\n<pre><code>import { Component, OnInit } from \"@angular\/core\";\r\nimport { Location } from \"@angular\/common\";\r\nimport { Router } from \"@angular\/router\";\r\nimport { Couchbase } from \"nativescript-couchbase\";\r\n\r\n@Component({\r\n    selector: \"profile-list\",\r\n    templateUrl: \".\/components\/profile-list\/profile-list.html\",\r\n})\r\nexport class ProfileListComponent implements OnInit {\r\n\r\n    public profiles: Array;\r\n    private database: any;\r\n\r\n    public constructor(private router: Router, private location: Location) { }\r\n\r\n    public ngOnInit() { }\r\n\r\n    public refresh() { }\r\n\r\n    public create() { }\r\n\r\n}<\/code><\/pre>\n<p>In the above we have a <code>ProfileListComponent<\/code> class with a public variable to hold all our UI bound data and a private instance to our Couchbase database.<\/p>\n<p>We need to be able to navigate forward in the navigation stack and detect navigation backwards in the stack so we inject the <code>Router<\/code> and <code>Location<\/code> services into the <code>constructor<\/code> method. The <code>constructor<\/code> method also does the following:<\/p>\n<pre><code>public constructor(private router: Router, private location: Location) {\r\n    this.database = new Couchbase(\"data\");\r\n    this.database.createView(\"profiles\", \"1\", function(document, emitter) {\r\n        emitter.emit(document._id, document);\r\n    });\r\n    this.profiles = [];\r\n}<\/code><\/pre>\n<p>In the above <code>constructor<\/code> method we open our database and create a new MapReduce view. This view is very simplistic in the sense it will return a key-value pair of all documents in the database. There is no conditional logic around what it returns in this scenario. The <code>profiles<\/code> MapReduce view is the foundation of our querying.<\/p>\n<p>To query that view, we have the <code>refresh<\/code> method:<\/p>\n<pre><code>public refresh() {\r\n    this.profiles = [];\r\n    let rows = this.database.executeQuery(\"profiles\");\r\n    for(let i = 0; i &lt; rows.length; i++) {\r\n        this.profiles.push(rows[i]);\r\n    }\r\n}<\/code><\/pre>\n<p>After querying we push each of the results into our public <code>profiles<\/code> variable. Don&#8217;t get confused, the <code>profiles<\/code> variable is not the same as the <code>profiles<\/code> view.<\/p>\n<pre><code>public ngOnInit() {\r\n    this.location.subscribe(() =&gt; {\r\n        this.refresh();\r\n    });\r\n    this.refresh();\r\n}<\/code><\/pre>\n<p>The <code>ngOnInit<\/code> triggers after the <code>constructor<\/code> method. Not only do we execute our query, but we need to subscribe to navigation events so we can execute the query when returning to the page. This is because the <code>constructor<\/code> and the <code>ngOnInit<\/code> methods only trigger at load, not navigation backwards events.<\/p>\n<p>Our last method is the <code>create<\/code> method:<\/p>\n<pre><code>public create() {\r\n    this.router.navigate([\"profile\"]);\r\n}<\/code><\/pre>\n<p>This will eventually be triggered by button press and it will take us to the second screen.<\/p>\n<p>The UI for this page, found in the <strong>app\/components\/profile-list\/profile-list.html<\/strong>, will look like the following:<\/p>\n<pre><code>\r\n<label class=\"label\"><\/label>\r\n<\/code><\/pre>\n<p>The <code><\/code> will iterate over each item in our public array and convert them into rows. Each row will be of two columns where the first image column has a 50 width, and the second column stretches to fit.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>You just saw how to take your key-value <a href=\"https:\/\/www.nativescript.org\">NativeScript<\/a> with Couchbase application to the next level by adding MapReduce view queries for querying data based on document properties. While the profile data doesn&#8217;t do much, what if you wanted to sync what is stored in <a href=\"https:\/\/www.couchbase.com\">Couchbase<\/a> on the device to other devices? We&#8217;ll take a look at that next time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently wrote about using Couchbase as a key-value store in a NativeScript iOS and Android application built with Angular. In this example we saw how to collect user profile information to be saved or loaded from Couchbase on the [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1810,9327,1812],"tags":[1704,1543,1248,1589],"ppma_author":[9032],"class_list":["post-2487","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-mobile","category-javascript","category-n1ql-query","tag-angular","tag-javascript","tag-mapreduce","tag-nativescript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Key-value NativeScript with Couchbase application<\/title>\n<meta name=\"description\" content=\"Learn how to take your key-value NativeScript with Couchbase application by adding MapReduce view queries for querying data based on document properties.\" \/>\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\/blog\/es\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Querying for Couchbase Documents in a NativeScript Angular Mobile Application\" \/>\n<meta property=\"og:description\" content=\"Learn how to take your key-value NativeScript with Couchbase application by adding MapReduce view queries for querying data based on document properties.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/thepolyglotdeveloper\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-09T15:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:15:29+00:00\" \/>\n<meta name=\"author\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@nraboy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/\"},\"author\":{\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/bb545ebe83bb2d12f91095811d0a72e1\"},\"headline\":\"Querying for Couchbase Documents in a NativeScript Angular Mobile Application\",\"datePublished\":\"2017-01-09T15:00:00+00:00\",\"dateModified\":\"2025-06-14T03:15:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/\"},\"wordCount\":1204,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"keywords\":[\"Angular\",\"javascript\",\"MapReduce\",\"nativescript\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Mobile\",\"JavaScript\",\"SQL++ \\\/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/\",\"name\":\"Key-value NativeScript with Couchbase application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-09T15:00:00+00:00\",\"dateModified\":\"2025-06-14T03:15:29+00:00\",\"description\":\"Learn how to take your key-value NativeScript with Couchbase application by adding MapReduce view queries for querying data based on document properties.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2022\\\/11\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Querying for Couchbase Documents in a NativeScript Angular Mobile Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/bb545ebe83bb2d12f91095811d0a72e1\",\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g8863514d8bed0cf6080f23db40e00354\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"caption\":\"Nic Raboy, Developer Advocate, Couchbase\"},\"description\":\"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.\",\"sameAs\":[\"https:\\\/\\\/www.thepolyglotdeveloper.com\",\"https:\\\/\\\/www.facebook.com\\\/thepolyglotdeveloper\",\"https:\\\/\\\/x.com\\\/nraboy\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/nic-raboy-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Key-value NativeScript with Couchbase application","description":"Aprende a llevar tu aplicaci\u00f3n NativeScript key-value con Couchbase a\u00f1adiendo consultas de vista MapReduce para consultar datos basados en las propiedades del documento.","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\/blog\/es\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/","og_locale":"es_MX","og_type":"article","og_title":"Querying for Couchbase Documents in a NativeScript Angular Mobile Application","og_description":"Learn how to take your key-value NativeScript with Couchbase application by adding MapReduce view queries for querying data based on document properties.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/","og_site_name":"The Couchbase Blog","article_author":"https:\/\/www.facebook.com\/thepolyglotdeveloper","article_published_time":"2017-01-09T15:00:00+00:00","article_modified_time":"2025-06-14T03:15:29+00:00","author":"Nic Raboy, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@nraboy","twitter_misc":{"Written by":"Nic Raboy, Developer Advocate, Couchbase","Est. reading time":"8 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/"},"author":{"name":"Nic Raboy, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1"},"headline":"Querying for Couchbase Documents in a NativeScript Angular Mobile Application","datePublished":"2017-01-09T15:00:00+00:00","dateModified":"2025-06-14T03:15:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/"},"wordCount":1204,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["Angular","javascript","MapReduce","nativescript"],"articleSection":["Best Practices and Tutorials","Couchbase Mobile","JavaScript","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/","url":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/","name":"Key-value NativeScript with Couchbase application","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-09T15:00:00+00:00","dateModified":"2025-06-14T03:15:29+00:00","description":"Aprende a llevar tu aplicaci\u00f3n NativeScript key-value con Couchbase a\u00f1adiendo consultas de vista MapReduce para consultar datos basados en las propiedades del documento.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/querying-for-couchbase-documents-in-a-nativescript-angular-mobile-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Querying for Couchbase Documents in a NativeScript Angular Mobile Application"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1","name":"Nic Raboy, Defensor del Desarrollador, Couchbase","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g8863514d8bed0cf6080f23db40e00354","url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","caption":"Nic Raboy, Developer Advocate, Couchbase"},"description":"Nic Raboy es un defensor de las tecnolog\u00edas modernas de desarrollo web y m\u00f3vil. Tiene experiencia en Java, JavaScript, Golang y una variedad de frameworks como Angular, NativeScript y Apache Cordova. Nic escribe sobre sus experiencias de desarrollo relacionadas con hacer el desarrollo web y m\u00f3vil m\u00e1s f\u00e1cil de entender.","sameAs":["https:\/\/www.thepolyglotdeveloper.com","https:\/\/www.facebook.com\/thepolyglotdeveloper","https:\/\/x.com\/nraboy"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/nic-raboy-2\/"}]}},"acf":[],"authors":[{"term_id":9032,"user_id":63,"is_guest":0,"slug":"nic-raboy-2","display_name":"Nic Raboy, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/2487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=2487"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/2487\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=2487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=2487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=2487"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=2487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}