node-ottoman: Error: parent cluster object has been closed

Hi, im new with ottoman, i try to call model findOne() Here is my model declare: `import { model, Ottoman, Schema } from ‘ottoman’ import { KEY_GENERATOR, PRICING_MODELS } from ‘…/…/consts’

const ottoman = new Ottoman() ottoman.connect('couchbase://****)

export const PriceSchema = new Schema({ propertyId: { type: String, required: true }, roomId: { type: String, required: true }, agreementId: { type: String, required: true }, rateId: { type: String, required: true }, rateType: { type: String, required: true }, allotment: Number, price: { type: Number, required: true }, isActive: { type: Boolean, required: true }, status: String, date: { type: String, required: true }, })

export const PriceModel = model(PRICING_MODELS.PRICE, PriceSchema, { collectionName: ‘prices’, keyGenerator: KEY_GENERATOR, })`

and const test = await PriceModel.findOne() console.log(test)

But i got error: Error: parent cluster object has been closed. Please tell me why? Thanks

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

I just want to thank you all for this thread, in the last 24 hours I decided to create my own new ORM package, highly inspired by node-ottoman https://github.com/stoqey/sofa

Things make more sense now 🤘🏿🙏🍾

Please don’t hesitate to throw some feedback on it

Thank you very much again

@gsi-alejandro thank you so much

Hi @zonorion

I already checked your repository, please follow the next two steps:

  1. Change the line 20 in the file couchbase.service.ts to const ottoman = new Ottoman({ collectionName: '_default' }); (This is needed to work with couchbase server 6.x without scopes/collections)
  2. You can fix the types error by setting this line in the tsconfig.json "skipLibCheck": true for now. (This bug will be fixed in the next alpha.13)

With the above steps, you must go ok.

Note: You can remove couchbase dependency (npm uninstall couchbase), maybe you added this while trying to fix the types error, but it’s no needed, Ottoman will provide the last couchbase version that works for the current Ottoman package.

Thank you.

Thank you, will see that you get some help here. Thanks for your patience.