** ayúdame, no funciona. formulario ejs para enviar el número de registro del estudiante a MongoDB obtener el resultado del estudiante individual por número de registro **
<section> <div> <form action="/result"> <label for="rollno">your Roll Number</label> <input type="number" name="rollno" placeholder="enter your roll number"> <button id="btn" type="submit">submit</button> </form> <br> <hr> <% if(details!=null) { %> <table class="table table-striped"> <thead> <tr> <th scope="col">Roll No</th> <th scope="col">Name</th> <th scope="col">Email</th> <th scope="col">Phone</th> <th scope="col">Result</th> </tr> </thead> <% details.forEach(function(item) { %> <tbody> <tr> <th scope="row"><%= item.rollno %></th> <td><%= item.name %></td> <td><%= item.email %></td> <td><%= item.phone %></td> <td><%= item.result %></td> </tr> </tbody> <% }) %> </table> <% } else { %> <h4>Enter your phone number for result</h4> <% }%> </div> </section>** código de nodejs para obtener el resultado del estudiante por número de rollo. No puedo obtenerlo, por favor ayuda a solucionarlo **
async result(req,res){ try{ await studentResult.find({rollno: '987625'},function(err,allDetails){ if(err){ console.log(err); }else { //console.log(allDetails) res.render('result',{details: allDetails}) } }) }catch (e){ console.log(e); } },Los errores de Mongodb se muestran en la terminal
MongooseError: la consulta ya se ejecutó: result.find ({rollno: 987625}) en model.Query._wrappedThunk [como _find]