Skip to content

Fix query select and query projection #700

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

Merged
merged 3 commits into from
Jan 17, 2016
Merged

Fix query select and query projection #700

merged 3 commits into from
Jan 17, 2016

Conversation

dimasdanz
Copy link
Contributor

The following projection does not work

DB::collection('items')->project(['tags' => ['$slice' => 1]])->get();

Because the new query driver is using option for projection.

And since selecting columns is now using projection too, this will also fix

$user = User::where('name', 'John Doe')->select('name')->first();

Added one more fix: Query using datetime instance
Because MongoDB\BSON\UTCDateTime expecting milliseconds and $datetime->getTimestamp returns value in seconds. So multiplying $datetime->getTimestamp value with 1000 will fix this

Revert previous projections since select columns is using projection.
@dimasdanz dimasdanz changed the title Fix normal query projection Fix query select and query projection Jan 16, 2016
jenssegers added a commit that referenced this pull request Jan 17, 2016
Fix query select and query projection
@jenssegers jenssegers merged commit b2f33fe into mongodb:pecl-mongodb Jan 17, 2016
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this pull request Sep 2, 2024
Fix query select and query projection
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

Successfully merging this pull request may close these issues.

2 participants