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

216
Views
I was trying to get some document from server side using query. but I am getting the whole collection instead of matched document.Whats wrong here?

client side code:From here I am trying to send request to the server

const MyItems = () => {
    const [user] = useAuthState(auth);
    const [myItems, setMyItems] = useState([]);

    useEffect(() => {

        const email = user.email;
        console.log(email);
        const url = `http://localhost:5000/products?email=${email}`;
        fetch(url)
            .then(res => res.json())
            .then(data => {
                console.log(data);
                setMyItems(data);
            })

    }, [user]);

server side code:from here i am trying to get response

app.get('/products', async (req, res) => {
            const email = req.query.email;
            console.log(email);
            const items= { email: email };
            const cursor = productCollection.find(items);
            const result = await cursor.toArray();
            res.send(result)

        })
over 4 years ago · Santiago Trujillo
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!