I have this route that I access from an AJAX GET call.
router.get("/index/fill/:id", function(req, res){
var idArray = req.params.id;
console.log(idArray); // OUTPUT = "4ed3ede8844f0f351100000c", "4ed3f117a844e0471100000d"
User.find({'_id': {$in: idArray}}, function(err, foundUsers){
console.log(foundUsers);
});
});
Before the start of the find proccess the code throws me this error:
Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
But when i use typeof in idArray[i] it says that it is a string.
What am I doing wrong here?
$.get("/index/fill/:id", {ids: arrayWithIds}, function(data){ ... })?router.get("/index/fill/:id", function(req, res){which is unusual.