Support the ongoing development of Laravel.io →
Database Eloquent Laravel.io
Last updated 1 year ago.
0

gafitescu said:

Check https://github.com/jenssegers/Laravel-MongoDB or https://github.com/navruzm/lmongo

Hi thanks for the reply. I was there already.

I want to return a record by document key, example $user = User::find('517c43667db388101e00000f');

The problem that I have is to write a simple model. I just want to get the idea of how the model works. This is what I got so far but it doesn't seem to work.

<?php

use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    protected $collection = 'users';

}

Do I need to write any function in the model class. If so, could you give me an example or hint?

Also, I am getting the following error

Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'MongoClient' not found

Thanks

Last updated 1 year ago.
0

You don't seem to have MongoDB extension installed for PHP. See here to install it : php.net/mongo

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tandasima tandasima Joined 12 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.