Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate: FieldPath field names may not start with '$'. #111

Closed
litan1106 opened this issue Feb 2, 2016 · 0 comments
Closed

Aggregate: FieldPath field names may not start with '$'. #111

litan1106 opened this issue Feb 2, 2016 · 0 comments

Comments

@litan1106
Copy link

I got the error when I passed the $filter array into the aggregateDocumentsByFilter function. However, I didn't get error when I declared the $filter inside of the aggregateDocumentsByFilter function. (It might be the '$' issue)

** $filter = [
['$match' => ['Id' => ['$eq' => $id]]],
];

// Error
public function aggregateDocumentsByFilter($collection, $filter)
{
$cursor = $collection->aggregate($filter);

    return $cursor;

}

// No Error
public function aggregateDocumentsByFilter($collection, $id)
{
$filter = [
['$match' => ['Id' => ['$eq' => $id]]],
];

    $cursor = $collection->aggregate($filter);

    return $cursor;

}**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant