Document:
{
\"_id\" : ObjectId(\"560c24b853b558856ef193a3\"),
\"name\" : \"Karl Morrison\",
\"pic\" : \"\",
\"language\" : ObjectId(\"560c24b
Try this
const User = require('User')
const mongoose = require("mongoose");
User.aggregate([
{
$match: { _id: new mongoose.Types.ObjectId('560c24b853b558856ef193a3') }
}
])
use toString() method
const User = mongoose.model('User')
User.aggregate([
{
$match: { _id: user_id.toString() }
}
]
const ObjectId = mongoose.Types.ObjectId;
const User = mongoose.model('User')
User.aggregate([
{
$match: { _id: ObjectId('560c24b853b558856ef193a3') }
}
])