Coding Global Background
Coding Global

Get db value

Archived 2 years ago
3 messages
1 members
Created 2 years ago
Updated 2 years ago
Open in Discord
I
ItIzYe
Verified
hi, ive got this code:
await interaction.guild.members.cache.forEach(member => {
            let memberXp =  Level.findOne({userID: member.user.id});
            const finMemberXp = memberXp.userID;
            console.log(memberXp.userID)
        });

and basically what i want is to go through every member.id of a server and check if there's a db entry for that id. But somehow when i print member xp
i get printed
: 'findOne',
  options: {},
  _conditions: { userID: '993985235870023794' },
  _fields: undefined,
  _update: undefined,
  _path: undefined,
  _distinct: undefined,
  _collection: NodeCollection {
    collection: Collection {
      collection: [Collection],
      Promise: [Function: Promise],
      modelName: 'Level',
      _closed: false,
      opts: [Object],
      name: 'levels',
      collectionName: 'levels',
      conn: [NativeConnection],
      queue: [],
      buffer: false,
      emitter: [EventEmitter]
    },
    collectionName: 'levels'

which is part of a big json and somehow i can't access the userID. DOes somebody know any help?

Replies (3)