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.

Using multiple buckets

See original GitHub issue

Ottoman’s bucket is initialized through a property (which seems odd, using a function or a constructor make more sense).

var ottoman = require('ottoman');
var couchbase = require('couchbase');
var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
ottoman.bucket = cluster.openBucket('default');

But, the important point here is: is there a way to change this bucket over time? It does not seems possible to create multiple ottoman instance, because the require('ottoman') is a already a constructor.

Some models will lies in a specific bucket and other models in another bucket.

So, how to use multiple buckets? Is Ottoman limited to one bucket for the time being?

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
brett19commented, Sep 9, 2016

Hey Guys, You can create as many Ottoman instances as you desire, they just won’t be directly accessible. For convenience, the Ottoman.js module returns a already-constructed Ottoman object, but you can create more, here is an example:

var ottoman = require('ottoman');
var ottoman2 = new ottoman.Ottoman();
var ottoman3 = new ottoman.Ottoman();
ottoman.store = ...;
ottoman2.store = ...;
ottoman3.store = ...;

P.S. Using multiple discreet Ottoman instances means that you are not able to reference between different models on different Ottoman instances. This is because the top-level Ottoman objects each maintain their own list of model data.

Cheers, Brett

1reaction
moxiouscommented, Sep 9, 2016

@kivervinicius see my comment earlier in this thread, you need to pass the bucket to the model via a store adapter, not to the ottoman instances.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Multiple Buckets AWS Amplify - Medium
So if we want to use the Amplify modules to upload or download files from more than one bucket we start facing some...
Read more >
Can I use multiple buckets? · Issue #1549 · aws-amplify ...
The Amplify Framework provides support for a single bucket for your projects. The recommended way by S3 is to add an additional sub-folder...
Read more >
Multiple s3-buckets in aws amplify - Stack Overflow
I get s3-access denied error as my bucket is private. I tried to add s3fullaccess permission to the backend role that is used...
Read more >
Amazon S3 Replication Adds Support for Multiple Destination ...
Amazon S3 Replication now gives you the ability to replicate data from one source bucket to multiple destination buckets. With S3 Replication ( ......
Read more >
How to use s3 life cycle policy for multiple buckets those ...
I have multiple buckets those stating with name dataplatform-raw , I wanted to apply life cycle policy to transition the data to s3...
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