mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
https://www.mongodb.com/docs/drivers/php/laravel-mongodb/
MIT License
7.02k stars 1.43k forks source link

Soft deletes not working on embedded documents #1513

Closed cheems77 closed 4 years ago

cheems77 commented 6 years ago

As referenced in Issue #422

I'm working with version 3.2 of this package and Laravel 5.5 and there doesn't appear to be a resolve.

The deleted_at attribute is set to false using the Jenssegers\Mongodb\Eloquent\SoftDeletes trait but queries still return documents where deleted: true

Giacomo92 commented 6 years ago

Hi @cheems77 I am stuck too with this. I tried with filter function. But everytime I filter on the embed document I lose the main collection's fields. I think now I will try with a Raw Expressions.

aowie1 commented 5 years ago

Any update on this? Dealing with the same problem... I also tried solving by adding a where condition to the EmbedsMany, but it throws an Exception: "... must return a relationship instance." I am using L5.5 with laravel-mongodb v3.3

Giacomo92 commented 5 years ago

Hi @aowie1 in the end I have realized that is not a simple implementation and not so useful. Infact I always keep the "delete data" in the master model.