derek
derek

Reputation: 41

Call to undefined method MongoDB\Driver\ReadConcern::isDefault()

I really don't know what the problem is!

class RegisterController extends Controller
{
    public function store(request $request)
    {

        $reg = Register::all();
        var_dump($reg);

and Register is

class Register extends Moloquent
{

    protected $connection='mongodb';
    protected $collection='registers';

}

Upvotes: 3

Views: 2623

Answers (2)

accexs
accexs

Reputation: 108

I solved it by setting my composer.json like this:

{
  "require": {
    "mongodb/mongodb": "1.1.2"
  }
}

Then run composer update

Upvotes: 2

Thiago Pereira
Thiago Pereira

Reputation: 614

Apparently this is a method that was taken from latest version of the library mongodb/mongodb.

This method is still available in the version: 1.1.2.

To resolve this issue temporarily, update the composer.lock file by replacing the following content:

{
    "name": "mongodb/mongodb",
    "version": "1.1.2",
    "source": {
        "type": "git",
        "url": "https://github.com/mongodb/mongo-php-library.git",
        "reference": "a307dd60e71e1291c60927ea4f3a1905146063f5"
    },
    "dist": {
        "type": "zip",
        "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/a307dd60e71e1291c60927ea4f3a1905146063f5",
        "reference": "a307dd60e71e1291c60927ea4f3a1905146063f5",
        "shasum": ""
    },
    "require": {
        "ext-mongodb": "^1.2.0",
        "php": ">=5.4"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.8"
    },
    "type": "library",
    "autoload": {
        "psr-4": {
            "MongoDB\\": "src/"
        },
        "files": [
            "src/functions.php"
        ]
    },
    "notification-url": "https://packagist.org/downloads/",
    "license": [
        "Apache-2.0"
    ],
    "authors": [
        {
            "name": "Jeremy Mikola",
            "email": "[email protected]"
        },
        {
            "name": "Hannes Magnusson",
            "email": "[email protected]"
        },
        {
            "name": "Derick Rethans",
            "email": "[email protected]"
        }
    ],
    "description": "MongoDB driver library",
    "homepage": "https://jira.mongodb.org/browse/PHPLIB",
    "keywords": [
        "database",
        "driver",
        "mongodb",
        "persistence"
    ],
    "time": "2017-02-16T18:40:32+00:00"
},

And run composer install

Upvotes: 0

Related Questions