How to make Leaderboard Command in mongoose

UserShema of user model

const mongoose = require("mongoose");

const UserSchema = new mongoose.Schema({
  _id: String,

  coins: { type: Number, default: 0 }

module.exports = mongoose.model("User", UserSchema);

I want to setup leaderboard by coins top to lowest

const discord = require("discord.js"); = async (client, message, args) => {
  let embed = new discord.MessageEmbed()
  var top = "None";
  let Leaderboard = await client.models.user.find({}, function(err, result) {
    if (err) {
      top = err;
    } else {
      result.forEach(userInfo => {
        //This makes the each object

I made a post a while ago asking how to do something very similar to this, but got no answer and would also like to know how

1 Like

lamo i think no mongodb support