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

316
Vistas
How to find a record by unique value inside an array in MongoDB?

I want to locate a record which has the "String to match" in his "affiliates.wallets" array. But for some reason, I'm unable to do it.

I was trying something like:

db.collection.findOne({ "affiliates.wallets": {$in: "[String to match]"}, (err, data) => console.log(err, data)})

But it returns null. So, I'm asking for help.

Simplified Wallet Schema:

Wallet {
  affiliates: {
    wallets: [String]
  }
}

P.S: I'm using findOne method because this "String to match" which I'm using to locate the record is unique and it can be located only in one record.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You don't need $in operator. You can do it like this:

db.collection.findOne({
  "affiliates.wallets": "String to match", 
}, (err, data) => {
  console.log(err, data)
})
over 4 years ago · Santiago Trujillo 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