Skip to content

Error when query count() with select #165

Closed
@merlosy

Description

@merlosy

Hi everyone,

I'm (really) new with Github and I recently found an issue when using a count() when there is a select statement in the query. I'm using the latest stable versions of Laravel 4.1 and this one.
If you try something like:
User::where('_id', '<>', 12)->count();
it will return the correct response whatever is in your database.. but if you try:
User::select( array('_id') )->where('_id', '<>', 12)->count();
I've got an error in: ­Mongodb/­Query/­Builder.php on line 167

If I replace:
return $results['result'];
with:
return $group[$key];
I have the correct result, but this "fix" doesn't look clean at all to me.

Is someone able to reproduce it? And thanks for the project, it's really great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions