mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

Home Page:https://www.mongodb.com/compatibility/mongodb-laravel-integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

model id property returns the builder and not the id

Treggats opened this issue · comments

  • Laravel-mongodb Version: 4.0.0
  • PHP Version: 8.2
  • Database Driver & Version: Mongo & db.version() gives me 7.0.0
  • Laravel 10.30.0

I've created #2661 for this issue.

Description:

laravel/framework#48852 updated the way method's are called/proxied.
It seems that it requires that the list with methods should be lowercase, as the Mongo Builder class doesn't have that the Builder is returned instead of the method that should have been called.

Steps to reproduce

  1. Laravel app version 10.30.0
  2. create connection / model which uses Mongo as backend
  3. $model->id would return the Builder

Expected behaviour

When calling $model->id I expect a string with the id for the model.

Actual behaviour

Calling $model->id returns a Builder instance.