GET STARTED, LEARN NoSQL

Get hands-on with sample code, example queries, tutorials, and more

SEO Information:

Head Title: Get Started, Learn NoSQL | Couchbase
Meta Description: Get hands-on with sample code, example queries, tutorials, and more.
Meta Keywords: Learn NoSQL, NoSQL Tutorials, NoSQL Examples, try n1ql, n1ql, couchbase tutorial, nosql books, couchbase getting started, couchbase tutorial, nosql books, getting started with nosql, couchbase getting started, couchbase server tutorial, couchbase tutorial for beginners, couchbase nosql tutorial, couchbase lite tutorial, couchbase mobile tutorial, nosql code example, nosql tutorial for beginners, ouchbase introduction, nosql query tutorial, nosql tutorial, nosql db tutorial, couchbase tutorial video, nosql for beginners, nosql online tutorial, couchbase, nosql example, nosql examples, couchbase database, no sql tutorial, no sql example, nosql example query no sql database tutorial, nosql database tutorial, nosql query example, nosql java tutorial, nosql tutorial point, nosql databases tutorial, learn nosql online, nosql commands, nosql basics, nosql application examples
Canonical URL:
  • Server
  • Mobile
Couchbase Server
Download Couchbase Server
  • Enterprise
  • Community
Compare
Couchbase Server 5.0.1 Enterprise

Couchbase Server 5.0.1 Enterprise Edition is a full-featured Engagement Database available free-of-charge for unlimited pre-production development and testing, with support from our Couchbase Forums.  Built on the most powerful NoSQL technology, Couchbase Server gives you the flexibility to constantly reinvent the customer experience. Experience unmatched agility, flexibility, and unparalleled performance on the easiest platform to manage, all risk-free before you revolutionize and deploy your mission-critical applications.  Note: Enterprise and Community editions are API compatible, so if you later decide you do not need enterprise-grade features and support, you can deploy on Community Edition.

This release provides a long list of exciting features in the areas of scalability, high-availability, performance, security, indexing, querying, search, tools, platforms and application development. It also enhances a wide ecosystem of big data and integration connectors.

Couchbase Server 5.0.1 Communtity

Couchbase Server 5.0.1 Community Edition is the open source version of our non-proprietary data platform, and supported in our Couchbase Forums for both development and deployment.  Like our Enterprise Edition, but without all the enterprise-grade features, it too is built on the most powerful NoSQL technology, and offers unmatched agility & flexibility, and unparalleled performance, on the easiest platform to manage.

Code Intro
Code Intro
																								Read
																							  // Get (Sync)
  JsonDocument myAirline = bucket.get("airline_5209");

  // Get (Async)
  Observable<JsonDocument>  myAirline = bucket.async().get("airline_5209"); // async using RxJava Observables!
																								Write
																							  // Insert (Sync)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  JsonDocument stored = bucket.upsert(JsonDocument.create("walter", passenger));

  // Insert (Async)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  Observable<JsonDocument> stored = bucket.async().upsert(JsonDocument.create("walter", passenger));

  // Upsert (Sync)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  JsonDocument stored = bucket.upsert(JsonDocument.create("walter", passenger));

  // Upsert (Async)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  Observable<JsonDocument> stored = bucket.upsert(JsonDocument.create("walter", passenger));

  // Replace (Sync)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  JsonDocument replaced = bucket.replace(JsonDocument.create("walter", passenger));

  // Replace (Async)
  JsonObject passenger = JsonObject.empty()
  .put("firstname", "Walter")
  .put("lastname", "White");
  Observable<JsonDocument> walter2 = bucket.async().replace(JsonDocument.create("walter", passenger));
																								Query
																							  // Query (String)
  Observable<AsyncN1qlQueryResult> theAirline = bucket
         .query(N1qlQuery
         .simple("SELECT name FROM `travel-sample` AS Airline WHERE id = 5209"));

  // Query (fluent API)
  Observable<AsyncN1qlQueryResult> theAirline = bucket
         .async()
         .query(N1qlQuery.simple(
           select("name")
             .from("travel-sample")
             .as("Airline")
             .where(x("id")
             .eq(5209))));
																					
																								Read
																							  // Get Document
  bucket.get("walter", function (err, resRead) {/* handle results */});
																								Write
																							  // Insert
  var key = "walter";
  bucket.insert(key, {firstname: "Walter", lastname: "White"},function(err, res) {/* handle results */});

  // Upsert
  var key = "walter";
  bucket.upsert(key, {firstname: "Walter", lastname: "White"},function(err, res) {/* handle results */});

  // Replace
  var key = "walter";
  bucket.replace(key, {firstname: "Walter", lastname: "White"},function(err, res) {/* handle results */});
																								Query
																							  // Query (String)
  var N1qlQuery = couchbase.N1qlQuery;
  var query = N1qlQuery.fromString("SELECT name FROM `travel-sample` AS Airline WHERE id = 5209");
  bucket.query(query,function(err,result){/* handle results */});
																					
																								Read
																							  // Get
  $res = $myBucket->get(‘document_name’);
																								Write
																							  // Insert
  $res = $myBucket->insert('document_name', array('some'=>'value'));

  // Upsert
  $res = $myBucket->upsert('document_name', array('some'=>'value'));

  // Replace
  $res = $myBucket->replace('document_name', array('some'=>'value'));
																								Query
																							  // Query (String)
  $myBucket->enableN1ql(array('http://1.1.1.1:8093/','http://1.1.1.2:8093/'));
  $query = CouchbaseN1qlQuery::fromString('SELECT * FROM default');
																					
																								Read
																							  ' Get (Sync)
  var result = bucket.GetDocument("airline_5209");
																								Write
																							  ' Insert (Sync)

  var passenger = new Document() {
   Firstname = "Walter",
   Lastname = "White"
  };
  bucket.Insert(passenger);

' Upsert (Sync)

  var passenger = new Document() {
   Firstname = "Walter",
   Lastname = "White"
  };
  bucket.Upsert(passenger);

  ' Replace (Sync)

  var passenger = new Document() {
   Firstname = "Walter",
   Lastname = "White"
  };
  bucket.Replace(doc);
																								Query
																							  ' Query (String)
  var query = new QueryRequest("SELECT name FROM `travel-sample` AS Airline WHERE id = 5209");

  ' Query (using LINQ)

   var airlinesQuerySyntax = (
     from fromAirport in ClusterHelper.GetBucket(CouchbaseConfigHelper.Instance.Bucket).Queryable<Airport>()
     where fromAirport.Airportname == @from
     select new { fromAirport = fromAirport.Faa, geo = fromAirport.Geo })
         .ToList() // need to execute the first part of the select before call to Union
         .Union<dynamic>(
             from toAirport in ClusterHelper.GetBucket(CouchbaseConfigHelper.Instance.Bucket).Queryable<Airport>()
             where toAirport.Airportname == to
             select new { toAirport = toAirport.Faa, geo = toAirport.Geo });
																					
																								Read
																							  # Get
  rv = bucket.get('document_name')
																								Write
																							  # Insert
  rv = bucket.insert('document_name', {'some': 'value'})

  # Upsert
  rv = bucket.upsert('document_name', {'some': 'value'})

  # Replace
  rv = bkt.replace('document_name', {'some':'newvalue'}
																								Query
																							  # Query (Simple)
  for row in bkt.n1ql_query('SELECT * FROM default'):

  # Query (Placeholders)
  q = N1QLQuery('SELECT fname, lname, age FROM default WHERE age > $age', age=22)
  for row in bkt.n1ql_query(q):
     ...
																					
																								Read
																							  // Get
  cas, err := myBucket.Get("document_name", &myValue)
																								Write
																							  // Insert
  cas, err := myBucket.Insert("document_name", &myDoc, 0)

  // Upsert
  cas, err := myBucket.Upsert("document_name", &myDoc, 0)

  // Replace
  cas, err := myBucket.Replace("document_name", &testValue, 0, 0)
																								Query
																							  // Query (String)
  myQuery := gocb.NewN1qlQuery("SELECT * FROM default")
  rows, err := myBucket.ExecuteN1qlQuery(myQuery)
																					
Download Couchbase

Download Couchbase Server

Code Intro

Code Intro

Download Couchbase Mobile
Download Couchbase Mobile
  • Enterprise
  • Community
Compare
Couchbase Lite 1.4.1

Couchbase Lite 1.4.1 Enterprise Edition is the most recent production-ready release of Couchbase Lite. Notable new features include LINQ support for .NET, along with performance improvements and enhancements.

Couchbase Lite 1.4.1

Couchbase Lite 1.4.1 Community Edition is the most recent release for community usage. This release is best for non-commercial developers who have no constraints on using these binaries in production systems. This release has not been subjected to the iterative test, fix and verify QA cycle that is a part of the Enterprise Edition release process.

  • Enterprise
  • Community
Compare
Sync Gateway 1.5.1

Couchbase Sync Gateway 1.5.1 Enterprise Edition is the most recent production-ready release of Sync Gateway. With Sync Gateway 1.5, you can seamlessly extend an existing Couchbase Server deployment to connect with remote edge devices that are occasionally disconnected or connected. Mobile, web and desktop applications can write to the same bucket in a Couchbase cluster. In this release, the metadata created by Sync Gateway, to facilitate replication between occasionally connected or disconnected edge devices and the cloud, is abstracted from applications reading and writing data directly to Couchbase Server.

 

Sync Gateway 1.5.1

Couchbase Sync Gateway 1.5.1 Community Edition is the most recent release for community usage. This release is best for non-commercial developers who have no constraints on using these binaries in production systems. With Sync Gateway 1.5, you can seamlessly extend an existing Couchbase Server deployment to connect with remote edge devices that are occasionally disconnected or connected. Mobile, web and desktop applications can write to the same bucket in a Couchbase cluster. In this release, the metadata created by Sync Gateway, to facilitate replication between occasionally connected or disconnected edge devices and the cloud, is abstracted from applications reading and writing data directly to Couchbase Server.

Code Intro
Code Intro
																							  // Get the database (and create it if it doesn’t exist).
  let database = CBLManager.sharedInstance().databaseNamed("mydb")

  // Create a new document (i.e. a record) in the database.
  let document = database.createDocument()
  document.putProperties(["firstName": "John"])

  // Update a document.
  document.update { (newRevision) -> Bool in
          newRevision["firstName"] = "Johnny"
          return true
  }

  // Delete a document.
  document.deleteDocument()

  // Create replicators to push and pull changes to and from the cloud.
  let url = NSURL(string: "https://www.my.com/mydb/")!
  let push = database.createPushReplication(url)
  let pull = database.createPullReplication(url)
  push.continuous = true
  pull.continuous = true

  // Add authentication.

  let authenticator = CBLAuthenticator.basicAuthenticatorWithName(name, password: password)
  push.authenticator = authenticator
  pull.authenticator = authenticator

  // Listen to database change events (there are also change events for
  // documents, replications, and queries).
  NSNotificationCenter.defaultCenter().addObserver(self, selector: "databaseChanged:",
  name: kCBLDatabaseChangeNotification, object: database) 

  // Start replicating. 
  push.start() 
  pull.start()
																					
																							  // Get the database (and create it if it doesn’t exist).
  CBLDatabase *database = [[CBLManager sharedInstance] databaseNamed: @"mydb"error: &error];

  // Create a new document (i.e. a record) in the database.
  CBLDocument *document = [database createDocument];
  [document putProperties: @{@"firstName": @"John"} error: &error];

  // Update a document.
  [document update:^BOOL(CBLUnsavedRevision *newRevision) {
      newRevision[@"firstName"] = @"Johnny";
      return YES;
  } error: &error];

  // Delete a document.
  [document deleteDocument:&error];

  // Create replicators to push and pull changes to and from the cloud.
  NSURL *url = [NSURL URLWithString: @"https://www.my.com/mydb/"];
  CBLReplication *push = [database createPushReplication: url];
  CBLReplication *pull = [database createPullReplication: url];
  push.continuous = YES;
  pull.continuous = YES;

  // Add authentication.
  CBLAuthenticator *authenticator = [CBLAuthenticator basicAuthenticatorWithName:name password:password];
  push.authenticator = authenticator;
  pull.authenticator = authenticator;

  // Listen to database change events (there are also change events for
  // documents, replications, and queries).
  [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(databaseChanged:)
   name: kCBLDatabaseChangeNotification 
   object: database]; 

  // Start replicating. 
  [push start]; 
  [pull start];
																					
																							  // Get the database (and create it if it doesn’t exist).
  Manager manager = new Manager(new JavaContext(), Manager.DEFAULT_OPTIONS);
  Database database = manager.getDatabase("mydb");

  // Create a new document (i.e. a record) in the database.
  Document document = database.createDocument();
  Map properties = new HashMap();
  properties.put("firstName", "John");
  document.putProperties(properties);

  // Update a document.
  document.update(new Document.DocumentUpdater() {
      @Override
      public boolean update(UnsavedRevision newRevision) {
          Map properties = newRevision.getUserProperties();
          properties.put("firstName", "Johnny");
          newRevision.setUserProperties(properties);
          return true;
      }
  });

  // Delete a document.
  document.delete();

  // Create replicators to push & pull changes to & from the cloud.
  URL url = new URL("https://www.my.com/mydb/");
  Replication push = database.createPushReplication(url);
  Replication pull = database.createPullReplication(url);
  push.setContinuous(true);
  pull.setContinuous(true);

  // Add authentication.
  Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(name, password);
  push.setAuthenticator(authenticator);
  pull.setAuthenticator(authenticator);

  // Listen to database change events (there are also change
  // events for documents, replications, and queries).
  database.addChangeListener(this);

  // Start replicators
  push.start();
  pull.start();
																					
																							  // Get the database (and create it if it doesn’t exist). 
  var database = Manager.SharedInstance.GetDatabase("mydb"); 

  // Create a new document (i.e. a record) in the database. 
  var document = database.CreateDocument(); 
  document.PutProperties(new Dictionary { 
      { "firstName", "John" } 
  }); 

  // Update a document. 
  document.Update(rev => 
  { 
      var props = rev.UserProperties; 
      props["firstName"] = "Johnny"; 
      rev.SetUserProperties(props); 
      return true; 
  }); 

  // Delete a document. 
  document.Delete(); 

  // Create replicators to push & pull changes to & from the cloud. 
  var url = new Uri("https://www.my.com/mydb/"); 
  var push = database.CreatePushReplication(url); 
  var pull = database.CreatePullReplication(url); 
  push.Continuous = true; 
  pull.Continuous = true; 

  // Add authentication. 
  var authenticator = AuthenticatorFactory.CreateBasicAuthenticator(name, password); 
  push.Authenticator = authenticator; 
  pull.Authenticator = authenticator; 

  // Listen to database change events (there are also change 
  // events for documents, replications, and queries). 
  database.Changed += OnChanged; 

  // Start replicators 
  push.Start(); 
  pull.Start();
																					
Sample Projects
Sample Projects

Couchbase Todo Training App: Step by Step

1. Grocery Sync app: A grocery checklist app for iOS and Android that demonstrates the Couchbase Mobile stack, which includes: local storage, synchronization, and cloud storage.

2. Starter app: A starter app for iOS that demonstrates the basics of Couchbase Lite APIs.

3. Photo Drop app: A photo sharing app that demonstrates Couchbase Mobile’s peer-to-peer capabilities.

Mobile API Overview
Mobile API Overview
Couchbase Lite
Native API

Objective-C, Swift, Java, Android, C#

Couchbase Sync Gateway
Getting Started Guide
Getting Started Guide

Step 1: Pick your mobile platform (iOS, tvOS, Android, macOS, .NET, and Java) and add Couchbase Lite to your app.

Step 2: Pick your operating system (Ubuntu, CentOS, Windows) or cloud/container provider (AWS or Docker) and add Sync Gateway to your app.

Step 3: Begin synchronizing data between Couchbase Lite and Sync Gateway using the following configuration file:

                    
{
    "databases": {
        "hello": {
            "server": "walrus:",
            "users": {"GUEST": {"disabled": false, "admin_channels": ["*"]}},
            "sync": `function (doc, oldDoc) {
                if (doc.sdk) {
                    channel(doc.sdk);
                }
            }`
        }
    }
}
                

This configuration file creates a database called hello and routes documents to different channels based on the doc.sdk property, if it exists.

Step 4: Run the application where Couchbase Lite is installed. You should then see the documents that were replicated on the admin UI at http://localhost:4985/_admin/.

For the full guide, please visit the developer portal.

Download Couchbase Mobile

Download Couchbase Mobile

Code Intro

Code Intro

Sample Projects

Sample Projects

Mobile API Overview

Mobile API Overview

Getting Started Guide

Getting Started Guide

How can we help you?

All fields must be filled out unless marked (optional)

View the Couchbase Privacy Policy and Terms of Service

form close button

Start today!

Get started in a few easy steps and join the NoSQL movement today!

I agree to the License Agreement

View the Couchbase Privacy Policy and Terms of Service