Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Intentando leer las propiedades del documento mongoDB

Estoy tratando de leer el nivel de propiedad habilitado de un documento almacenado en mi base de datos MongoDB. Cuando registro los datos devueltos en la consola después de encontrar el documento con GuildID (discord.js), registra el documento correcto, pero cuando intento verificar un valor en esos datos, la propiedad que estoy verificando no está definida. Aquí está mi código:

 const data = await serverdata.find({ //note serverdata is a reference to the serverdata Schema GuildID:message.guild.id }); if(!data) return; console.log(data.levelenabled) //the output of this is undefined therefore I can not check the boolean status

Y sí, la función es asíncrona.

También debo agregar que sí, el nivel de propiedad habilitado existe en el documento y al iniciar sesión en GuildID, tampoco está definido.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba findOne

 await serverdata.findOne(...)

Usar find o findMany devolverá un cursor .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!