How can I validate a field with MongoDB database?

0

Hello, I need to validate with normal laravel methods

 $this->validate($request, [
        $request['key'] => $valid->Validacion
    ]);
  • $request['key'] is a variable that happened to you
  • $valid->Validacion is the validation (valid many fields so I turned it dynamic).
  • The problem is that I have to validate a field that is being saved in a mongoDB database and to do the validation I have two problems

    This is the validation:

    required|email|unique:Tabla1SQL,email|unique:Tabla2MongoDB,P_1->email
    

    Problems:

  • If I do this the query tries to do it in a SQL base
  •   

    SQLSTATE [42S02]: Base table or view not found: 1146 Table 'table'   does not exist (SQL: select count (*) as aggregate from tabla where    P_1->email = [email protected])

  • The field where you have to verify that it is unique is a sub collection of a collection
  • asked by Alberto Ortega 01.11.2018 в 00:24
    source

    0 answers