skip to Main Content

Reactjs – UnhandledPromiseRejectionWarning: CastError: Cast to Number failed for value "[email protected]" (type string) at path "mobile" for model "users"

const express = require('express'); const app = express(); const Register = require('./model/register') require('./db/conection'); app.use(express.json()); app.get('/' , async(req,res)=>{ res.send("hello") }) app.get('/search/:key',async(req,res)=>{ let sKey=req.params.key; console.log(typeof(sKey)); let searchData=await Register.findOne({'$or':[ {name:sKey}, {email:sKey}, {address:sKey}, {mobile:sKey} ]}) res.send(searchData); }) app.listen(5000,()=>{ console.log("server start"); console.log(`http://localhost:5000`) }); I am…

VIEW QUESTION
Back To Top
Search