Skip to content

Issue with get() method when fetching data from Mongo Model #955

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

Closed
haridarshan opened this issue Sep 16, 2016 · 6 comments
Closed

Issue with get() method when fetching data from Mongo Model #955

haridarshan opened this issue Sep 16, 2016 · 6 comments

Comments

@haridarshan
Copy link

haridarshan commented Sep 16, 2016

Hi,

Sorry, for posting this issue over here because I don't know whether exact issue with this mongodb library v3.0.2 or laravel orm v5.3.4

I'am using Illuminate database orm with laravel-mongodb outside laravel framework. Recently I updated both libraries to latest release versions and suddenly I started getting issue with get() when fetching data from collection. Previous version which I was using were laravel database v.5.2.43 and laravel-mongodb v3.0.0

This is the call am using and getting below error.

$getFacebookPosts = \App\Models\Mongo\Facebookpost::where(
    'facebook_account_id', $userDetails['facebook']['id']
)
->where('created_at', '>', $date_from)
->where('created_at', '<=', $date_to)
->get();
Fatal error: Uncaught Error: Call to a member function all() on array in /var/www/app/vendor/illuminate/database/Eloquent/Builder.php:613 Stack trace: #0 /var/www/app/vendor/illuminate/database/Eloquent/Builder.php(318): Illuminate\Database\Eloquent\Builder->getModels(Array) #1 /var/www/app/lib/App.php(3833): Illuminate\Database\Eloquent\Builder->get() #2 /var/www/app/influencer/partials/facebook-user-details.php(4): App->facebookUserData('15') #3 {main} thrown in /var/www/app/vendor/illuminate/database/Eloquent/Builder.php on line 613
@cherbert
Copy link

cherbert commented Sep 16, 2016

You need to update composer to install "jenssegers/mongodb": ^"3.1" which is the dev branch compatible with Laravel 5.3

@haridarshan
Copy link
Author

haridarshan commented Nov 9, 2016

Hi,

Still getting this error after updating

illuminate database from v5.2.43 to v5.3.16
jenssegers/mongodb from v3.0.0 to v3.1.3

Fatal error: Uncaught Error: Call to a member function all() on array in /var/www/app/vendor/illuminate/database/Eloquent/Builder.php:613 Stack trace: #0 /var/www/app/vendor/illuminate/database/Eloquent/Builder.php(318): Illuminate\Database\Eloquent\Builder->getModels(Array) #1 /var/www/app/vendor/illuminate/database/Eloquent/Model.php(632): Illuminate\Database\Eloquent\Builder->get(Array) #2 /var/www/app/config.php(138): Illuminate\Database\Eloquent\Model::all() #3 /var/www/app/handler.do(3): require('/var/www/app...') #4 {main} thrown in /var/www/app/vendor/illuminate/database/Eloquent/Builder.php on line 613

@wedgwood
Copy link

Still getting this error after updating too.

@haridarshan
Copy link
Author

Yes, only when am using latest release version of illuminate database

@wedgwood
Copy link

@haridarshan you could solve it use method from #1037 before fixed.

@haridarshan
Copy link
Author

haridarshan commented Jun 27, 2017

@wedgwood
Thanks

Since am using different components from different frameworks in our project so is it possible to have that fix inside shouldUseCollections method. That will be great when anyone using laravel-mongodb outside laravel framework.

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

3 participants