Reputation: 38
Ok, so here's some context. Basically, I'm making a Discord bot and I'm 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,
})
Upvotes: 0
Views: 2853
Reputation:
with mongodb command
db.collection.insert({...})
You can check it out here
OR
with mongoose
myModel.create({...})
You can check it out here
Upvotes: 1
Reputation: 13
insertOne is not available in mongoose
try reading more on this this answer of stackoverflow : insertOne is not a function
Upvotes: 1