Document not found Ottomann

I have tried Ottomann but I get document not found error, why ?

const ottoman = new Ottoman({scopeName: 'sf_scope'});

await ottoman.connect({
  connectionString: 'couchbases://cbxxxxcmxxxx',
  bucketName: 'sf_bucket',
  username: 'xxxx',
  password: 'xxxx'

await ottoman.start();

const ProductsSchema = new Schema({
  click: String

const Products = ottoman.model('products', ProductsSchema);

app.get('/', async(req, res) => {
  try {
    const products = await Products.findById('product1')


  } catch(e) {


[DocumentNotFoundError: document not found] { 
  cause: [Error: document_not_found (101)] {  
    ctxtype: 'key_value',
    code: 101,
    id: 'products::product1',
    opaque: 12,
    cas: Cas<0>,
    status_code: 1,
    enhanced_error_info: undefined,
    last_dispatched_to: '', 
    last_dispatched_from: '',
    retry_attempts: 0,
    retry_reasons: []

Well, in the error message it says : id: ‘products::product1’
And in the document it shows “id”:“product1”

So you’ll need to refer to the Ottoman documention to find out what ottoman uses for the id.

Ok - the first example shows But I don’t see in your code. So it looks like you are inserting a ‘product1’ document outside of Ottoman. And when you try to read it inside of Ottoman, it was not saved with the id that Ottoman would use.

it is there I created on the shell

You created it in the shell with the wrong id.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.