Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda