0

Ok, so here's some context. Basically, i'm making a discord bot and im using mongoose to store user data, like how much gold they have in their bank, but I've tried looking at tutorials and copying code(we're all guilty of it) but nothing seems to work. Here's my code:

const user = db.collection.insertOne({
            _id: mongoose.Types.ObjectId,
            guild: msg.guild.id,
            gold: 0,
        })
walieeldin
  • 38
  • 10

2 Answers2

1

insertOne is not available in mongoose

try reading more on this this answer of stackoverflow : insertOne is not a function

d_bish
  • 13
  • 2
1

with mongodb command

db.collection.insert({...})

You can check it out here

OR

with mongoose

myModel.create({...})

You can check it out here