What is the recommended equivalent of cascaded delete in MongoDB for N:M relationships?

What you are doing is the best and most optimal way of doing it in Mongo. I am in a similar situation and after going all possible implementations of the N:M design pattern, have also arrived to this same solution. Apparently, This is not a mongodb thing, but more of a concept of NoSQL, wherein, … Read more

Entity Framework 4.1 InverseProperty Attribute and ForeignKey

It is theoretically correct but SQL server (not Entity framework) doesn’t like it because your model allows single employee to be a member of both First and Second team. If the Team is deleted this will cause multiple delete paths to the same Employee entity. This cannot be used together with cascade deletes which are … Read more

Is it possible to delete from multiple tables in the same SQL statement?

Nope, you’d need to run multiple statements. Because you need to delete from two tables, consider creating a temp table of the matching ids: SELECT U.Id INTO #RecordsToDelete FROM Users U JOIN LinkingTable J ON U.Id = J.U_Id … And then delete from each of the tables: DELETE FROM Users WHERE Id IN (SELECT Id … Read more

What are the options for overriding Django’s cascading delete behaviour?

Just a note for those who run into this issue as well, there is now an built-in solution in Django 1.3. See the details in the documentation django.db.models.ForeignKey.on_delete Thanks for editor of Fragments of Code site to point it out. The simplest possible scenario just add in your model FK field definition: on_delete=models.SET_NULL

CoreData + iCloud + Cascade Delete – how to handle?

From experience, listening to notifications other than NSManagedObjectContextDidSaveNotification is a big mess and can lead to relying on properties not yet updated. The detail view controller should listen to NSManagedObjectContextDidSaveNotification notifications, which are thrown after cascade is applied. You can then check by several means if the current object is valid or not (you can … Read more

Doctrine: cascade=”remove” vs orphanRemoval=true

The basic difference between them is: When using the orphanRemoval=true option Doctrine makes the assumption that the entities are privately owned and will NOT be reused by other entities. If you neglect this assumption your entities will get deleted by Doctrine even if you assigned the orphaned entity to another one. Say your User has … Read more

tech