Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

83
Views
How I email implement in query on my code

This is a MongoDB API I create '/inventoryItems' this API already shows for all Inventory items

This is my back-end database FORM data

{ _id:2749d97592b4b1d084e20a2
    supplierName:"carsale"
    email:"imd572258@gmail.com"
    brand:"audi"
    quantity:"1"
    price:"520"
    description:"car want need want "
    img:"https://res.cloudinary.com/dk0lorahh/image/upload/v1648239069/
  }

How i do use const email = req.query.eamil const query={email :email}

app.get("/inventoryItems", async (req, res) => {

  const page= parseInt(req.query.page);
  const size =  parseInt(req.query.size);
  **const email = req.query.email**
  const query = {}; 
  const cursor = inventoryItemsCollection.find(query);    
  let inventoryItems ;
  if( page || size ){

    inventoryItems = await cursor.skip(page*size).limit(size).toArray();
    
    
  }else{

    inventoryItems = await cursor.toArray();
  }
  res.send(inventoryItems);
});

  **if i do like this** 

const page= parseInt(req.query.page);
  const size =  parseInt(req.query.size);
  const email = req.query.email
  **const query = {email: email};** 
  const cursor = inventoryItemsCollection.find(query);    
  let inventoryItems ;
  if( page || size ){

    inventoryItems = await cursor.skip(page*size).limit(size).toArray();


  }else{

    inventoryItems = await cursor.toArray();
  }
  res.send(inventoryItems);
});

it's working find the email result but When mY Form data are not working not showing

 showing empty 
     []

I want a way how to do both works email results and my form results showing

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!