Finding results with mongodb

I have a db full of skills and I’m trying to make an info cmd where if you type the skill name you will get some info on it. Some skills are 2-3 arguments. For example "Animal Call". I want to be able to find my skill in mongodb by typing both !info animal call and for example something short like !info ani call

The problem about this is that if i try to find it with !info ani call it wont show up as a result.

Here’s my code:

let skill = args.slice(0).join(" ");

const skillDB = await Skill.find({})

for (let i = 0; i < skillDB.length; i++) {
 if (skillDB[i].skillName.toLowerCase().includes(`${skill.toLowerCase()}`)) {
  const embed = new MessageEmbed()
  .setDescription(`\`${skillDB[i].skillIcon}\` ${skillDB[i].skillName}`)
  .setImage(skillDB[i].skillImg)
  return message.channel.send(embed)
 }
}

129 thoughts on “Finding results with mongodb”

  1. Its like you read my thoughts! You appear to grasp so much approximately this, like you wrote the book in it or something.
    I believe that you can do with some percent to force the message home
    a little bit, however instead of that, this is fantastic blog.

    An excellent read. I will definitely be back.

    Reply
  2. Hey! This is my first comment here so I just wanted to give a quick shout
    out and say I really enjoy reading through your posts.
    Can you suggest any other blogs/websites/forums that go over
    the same subjects? Thanks!

    Reply
  3. I think this is among the most important information for me.
    And i am glad reading your article. But wanna remark on some general things,
    The website style is wonderful, the articles is really nice :
    D. Good job, cheers

    Reply
  4. I have been browsing on-line greater than three hours lately, but I by no means found any attention-grabbing article like yours.
    It’s beautiful price enough for me. Personally, if
    all site owners and bloggers made good content as you probably did, the web shall be a lot more helpful than ever before.

    Reply
  5. It’s a shame you don’t have a donate button! I’d most certainly donate to this excellent blog!
    I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google
    account. I look forward to new updates and will share
    this site with my Facebook group. Chat soon!

    Reply
  6. I think this is one of the most important information for me.

    And i’m glad reading your article. But wanna remark on few general things, The
    website style is ideal, the articles is really excellent : D.
    Good job, cheers

    Reply
  7. This design is steller! You definitely know how to keep
    a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well,
    almost…HaHa!) Great job. I really enjoyed what you had to say, and more than that, how
    you presented it. Too cool! ps4 https://bit.ly/3z5HwTp ps4 games

    Reply

Leave a Comment