CouchbaseGetCollection
Get a Couchbase collection instance for document operations.
Syntax
couchbaseGetCollection(cacheName, [scopeName], [collectionName])Parameters
cacheName
String
Yes
-
Name of the cache configuration
scopeName
String
No
_default
Name of the scope within the bucket
collectionName
String
No
_default
Name of the collection within the scope
Returns
Returns the Couchbase Collection instance with access to:
Document CRUD operations (get, insert, upsert, replace, remove)
Binary operations
Subdocument operations
Query execution
Full-text search
Examples
Get Default Collection
Get Custom Collection
Multiple Collections
Document Operations
Subdocument Operations
Binary Operations
Notes
Default collection is
_defaultin_defaultscopeCollections provide document-level organization within scopes
Collection names are case-sensitive
Collection must exist in Couchbase or operation will fail
Most cache operations use the default collection automatically
Direct collection access is for advanced scenarios
Collection Benefits
Document type isolation - Separate users, orders, products, etc.
Schema flexibility - Different document structures per collection
Index optimization - Create indexes specific to collection
Access control - Grant permissions per collection
Query performance - Queries run faster on smaller collections
Related Functions
couchbaseGetBucket - Get bucket instance
couchbaseGetScope - Get scope instance
couchbaseQuery - Execute queries
See Also
Last updated
Was this helpful?
