question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create Scopes & Collections - ensureCollections

See original GitHub issue

In the current implementation, the ottoman.start() method is used to bootstrap Ottoman.

  • ottoman.start() method accepts configuration useCollections() this should be removed.

Create / modify methods

ensureIndexes - creates indexes depending on the scenario. ensureCollections - creates scopes and collections depending on the scenario

start - calls ensureCollections() first and then ensureIndexes().

ensureCollections() - Below are different scenarios

  • Scenario 1: Scopes & Collections UNSUPPORTED, If a user configures scopeName and collectionName then ensureCollections() should attempt to create the scope and collection, the attempt to create a scope and collection should fail because this feature is not supported by Couchbase Server. The code should rely on the exception thrown by the underlying SDK (probably unsupported exception) and then return a proper error message to the user: This version of Couchbase Server does not support scopes and collections.

Note: There is no mechanism currently that will let you know if the Cluster you are working with supports Scopes & Collections or that will give you the server version back, you will have to rely on the underlying SDK error message for this. At the time of creating this issue, an open issue in Node.js SDK exists that takes care of throwing the right exception back. Until this is resolved using a global configuration in your tests assuming Supported vs Unsupported Platform

  • Scenario 2: Scopes & Collections UNSUPPORTED, If the user DOES NOT configure a scopeName and collectionName then ensureCollections() should NOT attempt to create the default scope and default collection.

  • Scenario 3: Scopes & Collections SUPPORTED, If user configures scopeName and collectionName then ensureCollections() should attempt to create the scope and collection.

  • Scenario 4: Scopes & Collections SUPPORTED, If the user DOES NOT configure a scopeName and collectionName then ensureCollections() should NOT attempt to create default scope and default collection, because _default a scope cannot be dropped. A _default collection can be dropped but it cannot be recreated (so no point in attempting to recreate)

as a general guideline

ensureCollections should be called before ensureIndexes. Global Scope and Collection configuration takes precedence over Model Level Scope and Collection

The repository below exhibits in general test cases with a certain combination of global and Model Configuration for 7.0 Server and for Legacy (Unsupported Database)

Note : the above repository doesn’t necessarily give all permutations and combinations of global vs model level configuration that should follow the general guidelines as discussed above. However, the repository gives you examples of how to do global configuration and what to expect as an outcome.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brett19commented, Nov 27, 2020

The default should be ‘_default’ rather than the model name. There is another global-level config option which we will likely want in the future which provides the behaviour you described, but for compatibility reasons it cannot be the default.

0reactions
AV25242commented, Apr 20, 2021

Even though the issue on the customer side is still open, the latest comments indicates that these issues can be closed. We may open a new issue as needed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage Scopes and Collections | Couchbase Docs
Scopes and collections, which allow documents to be categorized and organized within a bucket, can be created and deleted within the Capella UI....
Read more >
Build Modern Multi-Tenant Applications Using Collections and ...
Couchbase Server 6.5 introduced a Developer Preview of the Collections feature. Collections open up many possibilities for application ...
Read more >
Limiting Actions Related to Portfolios and E-collections ...
User actions related to electronic collection and portfolios are limited according to the scope of the user role. Users whose role scope is ......
Read more >
Guidelines for Writing a Scope of Collections Statement
We must only acquire objects we are able to care for properly; collect materials only when it is legally and ethically appropriate to...
Read more >
Fundamentals of role-based administration for Configuration ...
With the combination of roles, scopes, and collections, you segregate the administrative assignments that meet your organization's requirements.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found