I am using your project laravel-mongodb. It is very helpful for me.
However, I have some problem when using laravel-mongodb.
How to make index for username
Please give me more example how to using:
$client = DB::getMongoClient();
$db = DB::getMongoDB();
I cannot using DB in laravel Controller
$client = DB::collection('spot')->where('name', 'John')->get();
I got an error:
Call to undefined method Illuminate\Database\MySqlConnection::collection();
Please help me!
I have the same issue.
I found the Solution for this error.
You have to use this
$db = \DB::connection('mongodb')->getMongoClient();
and mongodb is the name that you use in the config/database.php
Thank Wu4m4n,
I found other solution.
I custom other class to connect direct to mongodb via php driver mongodb/mongodb.
Most helpful comment
I found the Solution for this error.
You have to use this
$db = \DB::connection('mongodb')->getMongoClient();and mongodb is the name that you use in the config/database.php