bwgjoseph / mongoose-vs-ottoman

feature comparison between mongoose and ottoman
0 stars 1 forks source link

connect #110

Open bwgjoseph opened 3 years ago

bwgjoseph commented 3 years ago

Hi,

Want to clarify something regarding the connect API.

If I have declare a connection with something like this

ottoman = new Ottoman({ scopeName: 'testDropScope', collectionName: 'testDropCollection', consistency });

await ottoman.connect({
    connectionString: 'couchbase://localhost',
    bucketName: 'testDropBucket',
    username: 'user',
    password: 'password'
});

await ottoman.start();

Would ottoman attempt to create the bucket, scope, and collection for me, if those were not created before?

Based on this ensure-collections-docs, it seem that it would/should at least do it for scope and collection but it does not even if I had manually created the bucket from the UI beforehand.

Based on my test, scope and collection are not being created automatically even if the bucket exist.

Also, I couldn't find it in the docs, but I think this would be good to include for the bucket one, based on your response.

Thanks


update:

If I specify a non-existent bucket, and had declared model before start method, it would throw this error

image

bwgjoseph commented 3 years ago

So I think I may know where the issue is. It's because during the drop test suite I did not specify any model at all, before the start method. I suspect it is due to this and that's why the scope/collection does not get created automatically. Correct me if I'm wrong.

So I was testing on this manageBucket test suite which declares a model before the start

The first time I ran, it shows this error

image

And then I ran again, and it shows me a different one

image

And then I ran again, and it is successful now

image

Not too sure what's causing it, is it something that can be improved or needs to be fixed?