I'm having a problem with MongoDB console.logging only one data of a collection. I've already searched like infinite topics about this, but none of them does exactly what I want. I want to get one number data from my mongoose database. (I'm creating a discord.js bot) This is what the database looks like:
_id: 61bb8dc5a23c9a077066abf0
user: "soki#2400"
userId: "466270219132731392"
amount: 16
__v: 0
and I want to console.log() the value of amount.
This is my code now:
console.log(giftsSchema.find({"_id": 0},{"user": msg.author.tag},{"userId": msg.author.id}).amount);
So what I want it to print is:
16
But it prints
undefined