【发布时间】:2021-01-12 00:30:22
【问题描述】:
好的,我目前正在尝试使用 MongoDB 创建一个“帮派”系统。我已经设置了一个积分系统并想创建“帮派”。我希望一个帮派的一个特征是它具有全球“财富”,它将所有具有该帮派角色的用户添加到一起并将其存储在数据库中。
我如何让所有具有特定角色的用户,然后检查他们的所有点并将它们加在一起。
我的猜测是运行Points.find({serverID: message.guild.id}).sort([[`points`, `descending`]
但是,我如何让所有成员都担任一个角色,这样我才能将他们的观点集中在一起。
我的积分模型:
const mongoose = require("mongoose");
const pointsSchema = mongoose.Schema({
userID: String,
userName: String,
serverID: String,
points: Number
});
module.exports = mongoose.model("Points", pointsSchema);
【问题讨论】:
标签: node.js mongodb discord discord.js