<commit_before>---
layout: "fluid/docs_base"
version: "4.3.0"
versionHref: "/docs/native"
path: ""
category: native
id: "couchbase-lite"
title: "Couchbase Lite"
header_sub_title: "Class in module "
doc: "Couchbase Lite"
docType: "class"
---

<h1 class="api-title">Couchbase Lite</h1>

<a class="improve-v2-docs" href="http://github.com/ionic-team/ionic-native/edit/master/src/@ionic-native/plugins/couchbase-lite/index.ts#L1">
  Improve this doc
</a>







<p>Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android</p>


<p>Repo:
  <a href="https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin">
    https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin
  </a>
</p>


<h2><a class="anchor" name="installation" href="#installation"></a>Installation</h2>
<ol class="installation">
  <li>Install the Cordova and Ionic Native plugins:<br>
    <pre><code class="nohighlight">$ ionic cordova plugin add couchbase-lite-phonegap-plugin
$ npm install --save @ionic-native/couchbase-lite
</code></pre>
  </li>
  <li><a href="https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module">Add this plugin to your app's module</a></li>
</ol>



<h2><a class="anchor" name="platforms" href="#platforms"></a>Supported platforms</h2>
<ul>
  <li>Android</li><li>iOS</li>
</ul>






<h2><a class="anchor" name="usage" href="#usage"></a>Usage</h2>
<pre><code class="lang-typescript">import { CouchbaseLite } from &#39;@ionic-native/couchbase-lite&#39;;
import { Http } from &#39;@angular/http&#39;;
import { Observable } from &#39;rxjs/Observable&#39;
constructor(private couchbase: CouchbaseLite, private platform:Platform,private _http:Http) {
   this.initMethod();
}
url:string;
initMethod() {
   this.couchbase.getURL().then((url)=&gt; {
       this.url = url;
   })
}
getUrl() {
     return this.url;
}
createDatabase(database_name:string) {
     let url = this.getUrl();
     url = url+database_name;
     return this._http
       .put(url)
       .map(data =&gt; { this.results = data[&#39;results&#39;] })
       .catch((error:any) =&gt; {
          return Observable.throw(error.json() || &#39;Couchbase Lite error&#39;);
        })
 }

deleteDatabase(database_name:string) {
     let url = this.getUrl();
     url = url+database_name;
     return this._http
       .delete(url)
       .map(data =&gt; { this.results = data[&#39;results&#39;] })
       .catch((error:any) =&gt; {<commit_msg>Automated build of native docs ionic-team/ionic-native@196adc8b2fe5922b676dec5c18c63e9e3a79d5b3<commit_after>---
layout: "fluid/docs_base"
version: "4.3.0"
versionHref: "/docs/native"
path: ""
category: native
id: "couchbase-lite"
title: "Couchbase Lite"
header_sub_title: "Class in module "
doc: "Couchbase Lite"
docType: "class"
---

<h1 class="api-title">Couchbase Lite</h1>

<a class="improve-v2-docs" href="http://github.com/ionic-team/ionic-native/edit/master/src/@ionic-native/plugins/couchbase-lite/index.ts#L1">
  Improve this doc
</a>







<p>Plugin to install Couchbase Lite in your PhoneGap app on iOS or Android</p>


<p>Repo:
  <a href="https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin">
    https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin
  </a>
</p>


<h2><a class="anchor" name="installation" href="#installation"></a>Installation</h2>
<ol class="installation">
  <li>Install the Cordova and Ionic Native plugins:<br>
    <pre><code class="nohighlight">$ ionic cordova plugin add couchbase-lite-phonegap-plugin
$ npm install --save @ionic-native/couchbase-lite
</code></pre>
  </li>
  <li><a href="https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module">Add this plugin to your app's module</a></li>
</ol>



<h2><a class="anchor" name="platforms" href="#platforms"></a>Supported platforms</h2>
<ul>
  <li>Android</li><li>iOS</li>
</ul>






<h2><a class="anchor" name="usage" href="#usage"></a>Usage</h2>
<pre><code class="lang-typescript">import { CouchbaseLite } from &#39;@ionic-native/couchbase-lite&#39;;
import { Http } from &#39;@angular/http&#39;;
import { Observable } from &#39;rxjs/Observable&#39;
constructor(private couchbase: CouchbaseLite, private platform:Platform,private _http:Http) {
   this.initMethod();
}
url:string;
initMethod() {
   this.couchbase.getURL().then((url)=&gt; {
       this.url = url;
   })
}
getUrl() {
     return this.url;
}
// DATABASES //
createDatabase(database_name:string) {
     let url = this.getUrl();
     url = url+database_name;
     return this._http
       .put(url)
       .map(data =&gt; { this.results = data[&#39;results&#39;] })
       .catch((error:any) =&gt; {
          return Observable.throw(error.json() || &#39;Couchbase Lite error&#39;);
        })
 }
deleteDatabase(database_name:string) {
     let url = this.getUrl();
     url = url+database_name;
     return this._http
       .delete(url)
       .map(data =&gt; { this.results = data[&#39;results&#39;] })
       .catch((error:any) =&gt; {
{'fraction_non_alphanumeric': 0.18148820326678766, 'fraction_numerical': 0.019560395240976004, 'mean_word_length': 4.270988310308183, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6976160', 'n_tokens_mistral': 1894, 'n_tokens_neox': 1796, 'n_words': 332}