I pass ids in a post request in postman and reference to another model and get
5dcf8dc320742961c8b5a801, 5dcf8eca20742961c8b5a808, 5dcf8c8fef739a6159938ca8
in my controller I convert them as
let ids = [req.body.ids]
console.log(ids)
and get
['5dcf8dc320742961c8b5a801, 5dcf8eca20742961c8b5a808, 5dcf8c8fef739a6159938ca8']
I wanted to convert them to an ObjectId so I tried
ObjectId(numberArray)
and
numberArray.map(num => ObjectId(num))
but all return
(node:25080) UnhandledPromiseRejectionWarning: Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters