#Data Not Found

16 messages · Page 1 of 1 (latest)

peak obsidianBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
twilit lion

Can you share some code of where you either fetch data or make new documents?

That just makes the model. In order to make a document you need to do something along the lines of:

const model = require('model path');
await model.create({ ... }).save();

iirc

Ok, so you catch any error and return

That's not gonna catch anything

if you do

const data = await Data.save();
console.log(data);

what does data log

wdym where? Where you do await Data.save() obviously

Ok so there's your document

Is it fetching that's the problem?

again, you catch and return so if it errors you don't log anything

logging things helps too

data is still a promise, so you’ll need to await it

And .catch(() => {}) is a bad practice. Log your errors, especially if things “don’t work”

And now it doesn’t. And if it errors you wouldn’t even know…