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.5 Enterprise

Couchbase Server 5.5 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.

Couchbase Server 5.5 was released in June 2018. This is the first maintenance release in the 5.5 series of Couchbase Server and includes important bug fixes applicable to all prior 5.x releases. We recommend that all customers upgrade to the 5.5 release and deploy these important bug fixes.

Couchbase Server 5.1.1 Community

Couchbase Server 5.1.1 Community Edition is the open source version of our non-proprietary data platform. It is supported by the community on Couchbase Forums, and is best suited for non-enterprise developers or non-commercial development where basic availability, performance, tooling, and query is sufficient. The Community Edition is available free of charge for both development and production, but is not subjected to the same rigorous "test, fix, and verify" quality assurance cycle as the Enterprise Edition, and is generally released several months behind Enterprise Edition. 

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 2.0.x Enterprise

Couchbase Lite 2.0.x Enterprise Edition extends the Couchbase Data Platform to the edge with a full-featured embedded database that supports key-value, query, full-text search, eventing, sync, and security -- both online and offline. It is available free of charge for unlimited pre-production development and testing, with support from our Couchbase Forums. Experience the unmatched agility, flexibility, and unparalleled performance on the easiest full-stack platform to manage, from the cloud to the edge, all risk-free as you revolutionize and deploy your mission-critical mobile 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.

Couchbase Lite 2.0 was released in April 2018. In addition to bug fixes, this release includes on-device data recovery, a new and simplified query interface, and Full-Text Search.
 

Couchbase Lite 2.0.x Community

Couchbase Lite 2.0.x Community Edition is the open source version of our non-proprietary embedded database. It is supported by the community on Couchbase Forums, and is best suited for non-enterprise mobile developers or non-commercial development where basic availability, performance, tooling, and query is sufficient. The Community Edition is available free of charge for both development and production, but is not subjected to the same rigorous "test, fix, and verify" quality assurance cycle as the Enterprise Edition and is generally released several months behind Enterprise Edition. 

  • Enterprise
  • Community
Compare
Sync Gateway 2.0 Enterprise

Couchbase Sync Gateway 2.0 Enterprise Edition provides seamless data synchronization from cloud to the edge with fine-grained access control, enterprise-grade security, and elastic scalability. It is available free of charge for unlimited pre-production development and testing, with support from our Couchbase Forums. Experience the unmatched agility, flexibility, and unparalleled performance on the easiest platform to manage, all risk-free as you revolutionize and deploy your mission-critical mobile applications.

Couchbase Sync Gateway 2.0 was released in April 2018. In addition to bug fixes, this release adds support for a websocket-based replication, introduces a no conflicts mode, and enables setting of document expiry via the sync function.

Sync Gateway 2.0 Community

Couchbase Sync Gateway 2.0 Community Edition is the open source version of our non-proprietary sync technology. It is supported by the community on Couchbase Forums, and is best suited for non-enterprise mobile developers or non-commercial development where basic availability, performance, tooling, and query is sufficient. The Community Edition is available free of charge for both development and production, but is not subjected to the same rigorous "test, fix, and verify" quality assurance cycle as the Enterprise Edition, and is generally released several months behind Enterprise Edition.

Code Intro
Code Intro
																							  OPEN DATABASE
// Get the database (and create it if it doesn’t exist).
let database = try Database(name: "my-database")

ADD  DOCUMENT
let newTask = MutableDocument()
       .setString("John", forKey: "firstName")
try database.saveDocument(newTask)


READ AND UPDATE  DOCUMENT
 guard let document = database.document(withID: "xyz") else { return }
let mutableDocument = document.toMutable()
mutableDocument.setString("jonny", forKey: "firstName")
try database.saveDocument(mutableDocument)
     
DELETE DOCUMENT
 try database.deleteDocument(mutableDocument)

ENABLING SYNC
let url = URL(string: "ws://localhost:4984/db")!
var replConfig = ReplicatorConfiguration(withDatabase: database, targetURL: url)
replConfig.replicatorType = .pull
let replication = Replicator(withConfig: replConfig)
replication.start()

QUERY
let query = QueryBuilder
   .select(SelectResult.all())
   .from(DataSource.database(database))
 .where(Expression.property("firstName").equalTo(Expression.string("jonny")))
   .limit(10)
																					
																							  OPEN DATABASE
CBLDatabase *database = [[CBLDatabase alloc] initWithName:@"my-database" error:&error];


ADD  DOCUMENT
CBLMutableDocument *newTask = [[CBLMutableDocument alloc] init];
[newTask setString:@"firstName" forKey:@"john"];
CBLDocument *saved = [database saveDocument:newTask error:&error];

READ/ UPDATE  DOCUMENT
CBLDocument *document = [database documentWithID:@"xyz"];
CBLMutableDocument *mutableDocument = [document toMutable];
[mutableDocument setString:@"jonny" forKey:@"firstName"];
[database saveDocument:mutableDocument error:&error];

DELETE  DOCUMENT
[database deleteDocument: doc error: &error];


ENABLING SYNC
NSURL *url = [NSURL URLWithString:@"ws://localhost:4984/db"];
CBLURLEndpoint *target = [[CBLURLEndpoint alloc] initWithURL: url];
CBLReplicatorConfiguration *config = [[CBLReplicatorConfiguration alloc] initWithDatabase:database target:target];
config.replicatorType = kCBLReplicatorTypePull;               
CBLReplicator *replicator = [[CBLReplicator alloc] initWithConfig:config];
[replicator start];


QUERY
CBLQuery *query = [CBLQueryBuilder select:@[[CBLQuerySelectResult all]]
                                    from:[CBLQueryDataSource database:database]
                      where:[[CBLQueryExpression property:@"firstName"]
equalTo:[CBLQueryExpression string:@"jonny"]]
   groupBy:nil having:nil orderBy:nil
   limit:[CBLQueryLimit limit:[CBLQueryExpression integer:10]]];
																					
																							  OPEN DATABASE
// Get the database (and create it if it doesn’t exist).
DatabaseConfiguration config = new DatabaseConfiguration(/* Android Context*/ context);
Database database = new Database("my-database", config);


CREATE DOCUMENT
MutableDocument newTask = new MutableDocument();
newTask.setString("firstName", "john");

database.save(newTask);

READ/ UPDATE  DOCUMENT
Document document = database.getDocument("xyz");
MutableDocument mutableDocument = document.toMutable();
mutableDocument.setString("firstName", "jonny");
 database.save(mutableDocument);

DELETE DOCUMENT
database.delete ( document);


ENABLING SYNC
URI uri = new URI("ws://localhost:4984/db");
Endpoint endpoint = new URLEndpoint(uri);
ReplicatorConfiguration config = new ReplicatorConfiguration(database, endpoint);
config.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL);
Replicator replication = new Replicator(config);
replication.start();

QUERY
Query query = QueryBuilder
       .select(SelectResult.expression(Meta.id),
               SelectResult.property("name"),
               SelectResult.property("type"))
       .from(DataSource.database(database))
       .where(Expression.property("firstName").equalTo(Expression.string("jonny")))
       .orderBy(Ordering.expression(Meta.id));
																					
																							  OPEN DATABASE
// Get the database (and create it if it doesn’t exist).
 var database = new Database("my-database");


CREATE DOCUMENT
var dict = new Dictionary {
   ["firstName"] = "john"
};

var newTask = new MutableDocument(dict);
database.Save(newTask);


READ/ UPDATE  DOCUMENT
var newTask = database.GetDocument(“docId”).toMutable();
// We can directly access properties from the document object:
newTask.SetString("firstName", "jonny");
database.Save(newTask);

DELETE DOCUMENT
database.Delete(newTask);

ENABLE SYNC
var url = new Uri("ws://localhost:4984/db");
var replConfig = new ReplicatorConfiguration(database, url);
replConfig.ReplicatorType = ReplicatorType.Pull;
var replication = new Replicator(replConfig);
replication.Start();

QUERY
using(var query = QueryBuilder.Select(SelectResult.Property("name"))
   .From(DataSource.Database(database))
   .Where(Expression.Property("firstName").EqualTo(Expression.String("jonny")))
   .Limit(10))
																					
Sample Projects
Sample Projects

Couchbase Todo Training App: Step by Step

1. Couchbase Travel Sample Training App: A step-by-step walkthrough of all the various features of Couchbase 2.0 using a sample travel application. Available for Swift, Java (Android), and C# (UWP, Xamarin).

2. Todo Sample App: A started to-do task list app for iOS, Android, and Windows.

3. A Query Playground for iOS: Playground for testing the Couchbase Lite 2.0 Query and Full-Text Search (FTS) capabilities.

Download Couchbase Mobile

Download Couchbase Mobile

Code Intro

Code Intro

Sample Projects

Sample Projects

How can we help you?

All fields must be filled out unless marked (optional)

Please check this box if you would like to be updated on offers, products, and services from Couchbase. You can unsubscribe at any time. Please review our Privacy Policy for additional details.

View our Privacy Policy.

form close button

Start today!

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

By checking this box you are agreeing to be updated on offers, products, and services from Couchbase. You can unsubscribe at any time. Please review our Privacy Policy for additional details.

View our Privacy Policy.

I agree to the License Agreement