Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
While setting my welcome channel ID to mongodb why my last two digit changes

When i am trying to set my welcome channel ID to MongoDB Why my channel last two digit chages to "00" for example 954226649841430572 --> (when i send to database it changes to) 954226649841430500

mongodb page

my code :

 await guild.updateOne(
          { guildID },
          { $set: { leavechannel: channelID } }
        );
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In MongoDB large numbers can sometimes be cut due to the nature of storing large Ints. Instead of saving the value raw as a number, first use the .toString() method and store the value as a string. This will eliminate the issue of MongoDB cutting off large Ints and because JS is dynamically typed will have no effect on using the ID as a number once you fetch it from MongoDB.

Similar question answered here about Ints that are too large

Edit: In addition to the large Int issue, Discord.js will parse snowflakes into strings anyways.

From https://discord.com/developers/docs/reference#snowflakes There are some cases in which our API and Gateway may return IDs in an unexpected format. Internally, Discord stores IDs as integer snowflakes. When we serialize IDs to JSON, we transform bigints into strings. Given that all Discord IDs are snowflakes, you should always expect a string.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda