- Run
docker-compose up -d
- Wait 5-10 sec for all services to fully initialized
- Launch a command prompt and run
docker exec -it mo-couchbase bash
- Once inside the container, run
cd scripts
then./setup-couchbase.sh
, typey
if prompted. See details below - You can now access couchbase via
localhost:8091
and login usingadmin:password
- You can now access mongo-express via
localhost:8881
This script will initialize and setup couchbase node and cluster using the couchbase-cli, hence, no manual setup is required. It will:
- Initialize the node with
admin:password
credentials - Initialize the cluster with only
data, index, query, fts
services enabled - Create
user:password
withfull admin
rights - Creates a bucket:
testBucket
- Enable
developer-preview
to enablescope and collections
feature - Creates a scope:
testScope
undertestBucket
- Creates a collection:
testCollection
undertestScope
Note: Step 5-7 is disabled currently due to issue connecting to couchbase with scope and collections enabled
Once the above is setup, run npm test
to ensure current test pass
Note: May need to run the command twice to get test pass for the very first run. Not sure the cause of it yet
You can now write test cases to verify the behavior of mongoose and ottoman
- Write all test cases in
/test
directory - Create one file per feature test case (e.g. $in.test.js, save.test.js)
Test cases that are indicated with .skip
are either
- Has issue that has been filed and waiting for fixes
- Needs to run as a standalone test instead of as a suite
- couchbase-cli
- bentonam/couchbase-docker
- manage-collections-with-cli
- migrating-from-mongodb-with-ottomanjs
- Migrating from MongoDB with Ottoman.js – Couchbase Connect 2016
- ottoman-demo
- v2.ottomanjs
- couchbase-getting-started-docker
- try-ottoman
Create Bucket:
/opt/couchbase/bin/couchbase-cli bucket-create --cluster localhost:8091 --username admin --password password --bucket testBucket --bucket-type couchbase --bucket-ramsize 100
Grab buckets stats:
/opt/couchbase/bin/cbstats -u admin -p password localhost:11210 -b testBucket all | grep collections
/opt/couchbase/bin/cbstats -u admin -p password localhost:11210 -b testBucket all | grep scopes
To create scope:
/opt/couchbase/bin/couchbase-cli collection-manage --cluster http://localhost:8091 --username admin --password password --bucket testBucket --create-scope testScope
To list scopes:
/opt/couchbase/bin/couchbase-cli collection-manage --cluster http://localhost:8091 --username admin --password password --bucket testBucket --list-scopes
To create collection:
/opt/couchbase/bin/couchbase-cli collection-manage --cluster http://localhost:8091 --username admin --password password --bucket testBucket --create-collection testScope.testCollection
To list collections:
/opt/couchbase/bin/couchbase-cli collection-manage --cluster http://localhost:8091 --username admin --password password --bucket testBucket --list-collections testScope
/opt/couchbase/bin/cbstats -u admin -p password -b testBucket localhost:11210 collections
/opt/couchbase/bin/cbstats -u admin -p password -b testBucket localhost:11210 collections-details