I am trying to find documents in my database using a query string:
app.get('/', (request, response) => {
db.collection('mycollection').find(req.query).toArray((error, results) => {
console.log(response)
})
})
The request looks like this:
{ userName: 'K Moe' }
And the error I get is:
MongoError: query selector must be an object
I've tried changing req.query to req.query.userName
and req.query['userName']
but that doesn't help...