public function addEagerConstraints(array $models)
{
// We'll grab the primary key name of the related models since it could be set to
// a non-standard name and not "id". We will then construct the constraint for
// our eagerly loading query so it returns the proper models from execution.
$key = $this->related->getKeyName();
$value = $this->getEagerModelKeys($models);
$value = array_map(function ($value) {
return $value instanceof MongoID ? $value : new MongoID($value);
}, $value);
$this->query->whereIn($key, $value);
}