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

143
Vistas
how can i get all the datas that have same value from mongodb?

in my database, there are two companies with same name.

[
  {
    "name": "samsung",
    "store_code": "34d"
  },
  {
    "name": "lg",
    "store_code": "333"
  },
  {
    "name": "lg",
    "store_code": "3511"
  }
]

like this..

my question is, I juse made my python function to get store information by name.

that looks like this..

async def fetch_store_by_name(store_name):
document = collection.find_one({"name":store_name})
return document

and I can only get the first lg company's information. how can I get both informations of lg company from my mongodb?

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

0

Use find instead of find_one .

https://www.w3schools.com/python/python_mongodb_find.asp

over 4 years ago · Santiago Trujillo Denunciar

0

I assumed you're using pymongo, just change find_one to find method. Like this:

async def fetch_store_by_name(store_name):
  document = collection.find({"name":store_name})
  return document

Here some documentation : https://pymongo.readthedocs.io/en/stable/tutorial.html#querying-for-more-than-one-document

over 4 years ago · Santiago Trujillo Denunciar

0

You can use collection.find({"name":store_name})

Reference: https://www.w3schools.com/python/python_mongodb_find.asp

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