#It gives this error

50 messages · Page 1 of 1 (latest)

grizzled barn
lost sail
#

When using set for example. You need the id as first parameter and the second parameter is the value

#

You are missing the second one. Missing means it's either not passed in the method or it's undefined

grizzled barn
#

I looked at the code but I didn't quite understand what you said.

lost sail
grizzled barn
#
jsdb.set("<id>");
``` instead of typing

```js
const value = undefined;
db.set("<id>", value);

So should I write this?

lost sail
#

No, they are both wrong

#

Both are missing the second argument

#

Set needs two arguments

#

And the second argument cannot be undefined

#

Set will set a value for that specific id

#

It needs the id and the value

#
await db.set("test", 1);
console.log(await db.get("test")); // 1
#

That is the correct usage of db set

grizzled barn
lost sail
#

Ah I ses what is happening

#

You catch the error bug log it so you get an other error after that

grizzled barn
#

Let me take a see at main.js

lost sail
#

But you are using mongoose and quick.db? That makes no sense

grizzled barn
#

I installed the Quick.db module but I don't remember using it

lost sail
#

You do use it

#

Let's get to the first error first since this one I know where it is

#

Since the second error that crashes your bot is cut off

grizzled barn
lost sail
#

The question is. Do you want to fix the first error or not? You already try catch it

grizzled barn
#

The first error doesn't turn off the bot or break the command, I don't think it's necessary to fix it

lost sail
#

Sure, it doesn't because you try catch it.

Let's get to the second error. The other source bin link you sent is invalid.
You also cut the second error from the screenshot so I can't tell you in which file it is. You will need to find it. That error is because you are missing the second parameter of a quick.db method

grizzled barn
#

sorry

#

sorry

#

I accidentally deleted the letter L

#

Do you think I should pull the db module from quick.db to mongoose?

lost sail
#

No worries.
If that is really the file where the second error happen. Then it's probably because of line 44

await db.set(`sondeprem`, ayn.timestamp);

This is bad.
You use set with the first and second parameter but you never checked if ayn.timestamp is defined

#

You only check if it's equal to an other value. Which that value can also be undefined

grizzled barn
#

so how do i use it as 1 different parameters? i don't know because coldsad

lost sail
#

You should check if ayn.timestamp is defined and only use it when it is. You need to do the rest, I don't know what you want to do if it's undefined

#
if(ayn.timestamp) {
   // ayn.timestamp is defined
} else {
   // ayn.timestamp is not defined
}```
grizzled barn
#

I'm going to paste it above line 44 and fix it, right?

lost sail
#

No, the current line 44 needs to be in the if part

#

You need to have ayn.timestaml defined to use it in db.set

grizzled barn
#

Got it, i will try it right away

#

This project was very important for me and all my friends, but I'm really angry with myself right now because I couldn't do it