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

114
Vistas
Cannot read property 'match' of null"

So I'm working on search bar function, where you can search name, email, phone, personal number, I had already name and email and it was working good, however, I added phone and personal number and I started to get these error... I can search right now phone and email, but when I try to search personal number and name I'm getting Cannot read property 'match' of null" Error from the console...

 user: async () => {
  const accessibleUsers = await UserController.getAccessible(req);
  const userCollection = db.collection(User.tableName);
  const nativeResults = await userCollection.find({
    _id: { $in: accessibleUsers.map((val) => ObjectID(val)) },
    vc_isLogEntity: false,
    // deleted: false, //TODO RN-732 Add back
    $or: [
      { email: matchRegex },
      { firstName: matchRegex },
      { lastName: matchRegex },
      { phone: matchRegex },
      { personnelNumber: matchRegex }
    ]
  }, {_id: 1}).toArray();

  const users = await User
    .find(nativeResults.map(r => `${r._id}`))
    .populate('role');
  return users.map(user => ({
    type: 'user',
    value: user,
    ...getMatches(user, ['email', 'firstName', 'lastName', 'phone', 'personnelNumber'])
  }));

I just added { phone: matchRegex },{ personnelNumber: matchRegex } and 'phone', 'personnelNumber' to the code.. Can someone help me how to avoid this error ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think personal Number check the spelling and check are you searching for the full name / FirstName and lastName ?

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