couchbaselabs / node-ottoman

Node.js ODM for Couchbase
https://ottomanjs.com/
Apache License 2.0
287 stars 98 forks source link

Document not found #747

Closed pullmann4rent closed 11 months ago

pullmann4rent commented 11 months ago

Hello,

Why I recieve document not found ?

import express from 'express';
import { cbdb } from './config/db';
import { Ottoman, Schema } from 'ottoman';

const app = express();

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

await ottoman.connect({
  connectionString: 'couchbases://cb.4lcmapxglzylh11p.cloud.couchbase.com',
  bucketName: 'sf_bucket',
  username: 'xxxx',
  password: 'xxxx'
});

await ottoman.start();

const ProductsSchema = new Schema({
  click: String
});

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

app.get('/', async(req, res) => {
  try {
    console.time("concatenation");

    const products = await Products.findById('123');

    console.log(products);

    console.timeEnd("concatenation");

    res.send('hello');
  } catch(e) {
    console.log(e);
    res.send(e);
  }
})

const port = process.env.PORT || 3000;
const server = app.listen(port, async () => {
  console.log(`server started on port: ${port}`);
});

fd

mikereiche commented 11 months ago

user error. Please make an effort to troubleshoot your code before filing a ticket.