We have snippets created for the following languages and SDKs: Java, .NET, Node.js, Python, Go, Ottoman, Spring Data, and Typescript.
When using the snippets for Spring Data the prefixes are different, they begin with @cbsd, rather than @cb. This is due to Spring Data and Java sharing the same file extensions.
The snippets for ottoman are listed at the bottom of this page. Due to how development is done using ottoman we required a different set of snippets to the rest of the supported languages. They also begin with @cbot, rather than @cb. This is due to Ottoman and Node.js sharing the same file extensions.
Category | Name | Shortcut | Description | Java Docs | .NET Docs | Node/TS Docs | Python Docs | Go Docs |
---|---|---|---|---|---|---|---|---|
Bootstrapping | ||||||||
Connect to Cluster | @cbcon | Connect to a cluster and get a refernece to it, a bucket, and a collection | Y | Y | Y | Y | Y | |
Connect to Cluser with TLS | @cbcontls | Connect to a cluster using TLS and get a reference to it, a bucket, and a collection. | Y | Y | Y | Y | Y | |
Connect to Cluster with DNS SRV | @cbcondns | Connect to a cluster using DNS SRV and get a reference to it, a bucket, and a collection. | Y | Y | Y | Y | Y | |
KV Ops | ||||||||
Import | @cbkvimp | Import all necessary KV namespace. | Y | Y | Y | Y | Y | |
Example | @cbkvex | Example code that shows: inserting, upserting, getting, replacing, and removing a document. Along with all required imports. | Y | Y | Y | Y | Y | |
Insert | @cbins | Insert a document into a collection. | Y | Y | Y | Y | Y | |
Upsert | @cbups | Upsert a document to a collection. | Y | Y | Y | Y | Y | |
Replace | @cbrep | Replace a document in a collection. | Y | Y | Y | Y | Y | |
Get | @cbget | Use a key to get a document from a collection. | Y | Y | Y | Y | Y | |
Remove | @cbrem | Use a key to remove a document from a collection. | Y | Y | Y | Y | Y | |
Transcoder | @cbtranscoder | Example code that shows how to use a RawJSONTranscoder on an upsert operation. | Y | Y | Y | Y | Y | |
Document Expiry | @cbsetexp | Use Document Expiration | Y | Y | Y | Y | Y | |
Subdocument Ops | ||||||||
Get Value | @cbsubget | Get or check the existence of a sub document value by providing document key and path. | Y | Y | Y | Y | Y | |
Upsert Value | @cbsubups | Modify the value of an existing path or create it if it does not exist. | Y | Y | Y | Y | Y | |
Insert Value | @cbsubins | Add a new value to a path that does not exist. | Y | Y | Y | Y | Y | |
Remove | @cbsubrem | Remove the value of an existing path. | Y | Y | Y | Y | Y | |
Array Operations | @cbsubarr | Example code showing different array operations. | Y | Y | Y | Y | Y | |
Array Append | @cbsubarrapp | Append a value to an existing array in a document. | Y | Y | Y | Y | Y | |
Array Prepend | @cbsubarrpre | Prepend a value to an existing array in a document. | Y | Y | Y | Y | Y | |
Array Add Unique | @cbsubarradd | Treat an existing array like a unique set and add a value. | Y | Y | Y | Y | Y | |
Array Insert At | @cbsubarrins | Insert a new element into an array at a specific position. | Y | Y | Y | Y | Y | |
Query Service | ||||||||
Import | @cbqimp | Import all necessary query namespaces | Y | Y | Y | Y | Y | |
Example | @cbqex | Example code that shows connecting to a cluster and running a query on it. | Y | Y | Y | Y | Y | |
Simple Select Query | @cbq | Use SQL++ to Query the Couchbase Cluster. | Y | Y | Y | Y | Y | |
Parameterized Query | @cbqparam | Use parameterised SQL++ to query the Couchbase Cluster. | Y | Y | Y | Y | Y | |
SQL++ Query With All Options | @cbqopts | Use SQL++ to Query the Couchbase Cluster, this has all options available. | Y | Y | Y | Y | Y | |
Using FTS with Query | @cbqfts | Use SQL++ to query the Couchbase Cluster with full text search. | Y | Y | Y | Y | Y | |
Analytics Service | ||||||||
Import | @cbanimp | Import all necessary Analytics namespaces. | Y | Y | Y | Y | Y | |
Example | @cbanex | Example code that shows connecting to a cluster and running an analytics query on it. | Y | Y | Y | Y | Y | |
Analytics Simple Select | @cbanq | Use SQL++ to Query the Analytics Service on the Couchbase Cluster. | Y | Y | Y | Y | Y | |
Parameterized Query | @cbanparamq | Use SQL++ to Query the Analytics Service on the Couchbase Cluster, this uses parameters. | Y | Y | Y | Y | Y | |
Search Service | ||||||||
Import | @cbftsimp | Import all necessary FTS namespaces | Y | Y | Y | Y | Y | |
Example | @cbftsex | Example code that shows connecting to a cluster and running an FTS query on it. | Y | Y | Y | Y | Y | |
Search Query | @cbfts | Use a query string on the Full Text Search Service of your Couchbase Cluster. | Y | Y | Y | Y | Y | |
Search Query With All Options | @cbftsopts | Create a FTS query that has all options shown to you. | Y | Y | Y | Y | Y | |
Management API | ||||||||
Collection Manager | @cbcolman | Connect to a cluster, and create a collection manager. | Y | Y | Y | Y | Y | |
Create a Collection | @cbcrcol | Create a new collection, this will create a new collection manager. | Y | Y | Y | Y | Y | |
Create a Collection Reference | @cbcol | Create a reference to an existing collection. | Y | Y | Y | Y | Y | |
Create a Scope | @cbcrscope | Create a new scope, this will create a new collection manager. | Y | Y | Y | Y | Y | |
Create a Bucket | @cbcrbuck | Create a new bucket on an existing cluster reference. | Y | Y | Y | Y | Y | |
Create a Bucket Reference | @cbbuck | Create a reference to an existing bucket. | Y | Y | Y | Y | Y | |
Create an Index | @cbcrindex | Create a new index, this will create a new index manager. | Y | Y | Y | Y | Y | |
Create a User | @cbupsuser | Add a user to your Couchbase Cluster. | Y | Y | Y | Y | Y | |
Transactions | ||||||||
Example | @cbcolman | Example code that shows connecting to a cluster and running a transaction on it. | Y | Y | Y | N | Y | |
Insert Transaction | @cbcrcol | Perform an insertion transaction | Y | Y | Y | N | Y | |
Get Transaction | @cbcol | Perform a get transaction | Y | Y | Y | N | Y | |
Replace Transaction | @cbcrscope | Perform a replace transaction | Y | Y | Y | N | Y | |
Remove Transaction | @cbcrbuck | Perform a remove transaction | Y | Y | Y | N | Y | |
Import | @cbbuck | Import all necessary transaction namespaces. | Y | Y | Y | N | Y |
Category | Name | Shortcut | Description |
---|---|---|---|
Bootstrapping | |||
Connect to Cluster | @cbcon | Connect to a cluster and get a reference to it, a bucket, and a collection. | |
Connect to Cluster With TLS | @cbcontls | Connect to a cluster using TLS and get a reference to it, a bucket, and a collection. | |
Model Operations | |||
Create Many | @cbotcm | Upsert multiple documents to the cluster | |
Create | @cbotc | Upsert a document to the cluster | |
Find | @cbotf | Find documents based on a filter | |
Find with Ignore Case | @cbotfig | Find documents based on a filter with the option to ignore case | |
Find with Limit | @cbotlim | Find documents based on a filter, while using a limit | |
Find with Select | @cbotfsel | Find documents and select fields | |
Find by ID | @cbotfid | Find a document using its ID | |
Find by ID with Select | @cbotfidsel | Find a document using its ID and select fields | |
Remove Many | @cbotrm | Remove many documents | |
Remove by ID | @cbotrmid | Remove a document using its ID | |
Update by ID | @cbotupdid | Update a document using its ID | |
Replace by ID | @cbotrepid | Replace a document using its ID | |
Find One | @cbotfone | Find one document with a filter | |
Find One with Select Fields | @cbotfonesel | Find one document with a filter and select fields | |
Upsert | @cbotups | Upsert a document using Model.findOneAndUpdate | |
Find and Populate | @cbotfpop | Find a document and populate nested documents | |
Update Many | @cbotupdm | Update all documents matching the given condition | |
Query | @cbotq | Query your couchbase cluster | |
Schema | |||
Create Index | @cbotind | Generate an Index on your schema | |
Create N1QL Index with Options | @cbotnqlind | Generate an SQL++ Index on your schema | |
Generate Model and Schema | @cbotgenmodel | Generate a model, a schema, and an SQL++ index | |
Generate Schema | @cbotschema | Generate a schema | |
Generate Model | @cbotmodel | Generate a model | |
Model Field | @cbotfield | Generate a model field | |
Model Field with all Options | @cbotfieldopts | Generate a model field with common options shown |