• PHP Drivers

      Hello,

      I found out that the EmbedsMany reverse binding doesn't work in my project, so I tried to create a clean project to see if the bug is somewhere in my project and it seems that the magic binding as it says in the documentation doesn't work even on a clean project.
      I define an Author class that embeds books.

      use MongoDB\Laravel\Eloquent\Model;
      class Author extends Model
      {
          public function books()
          {
              return $this->embedsMany(Book::class);
          }
      }

      Everything works ok until I try to get all the books out of the database using 
      $book = Book::get();
      or just the last one, as written in the documentation
      $book = Book::first();
      both of them will return empty.

      According to the documentation I quote: "The inverse relation is auto magically available. You can omit the inverse relation definition." My understanding is that the inverse relation is automatic and I don't have to do anything to get it. 

      PHP: 8.2
      Laravel: v10.43.0
      mongodb/laravel-mongodb: 4.1.1
      mongo: 7.0.5

            Assignee:
            andreas.braun@mongodb.com Andreas Braun
            Reporter:
            jakubnvt@gmail.com Jakub Novotný
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: