MongoDB DBRef ON DELETE CASCADE [英] MongoDB DBRef ON DELETE CASCADE

查看:175
本文介绍了MongoDB DBRef ON DELETE CASCADE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在MongoDB中有一个具有ON DELETE CASCADE功能的外键?

我知道你可以使用DBRef作为一种外键但是当引用指向的集合中的项被移除时,引用返回null。但是我希望参考所属的项目被删除。

或者我需要每次删除的东西检查引用它?

解决方案

现在这个功能不存在。如果你想要的话。在MongoDB Bugtracker上添加它

http://jira.mongodb.org


Is there a way in MongoDB to have a foreign key with a 'ON DELETE CASCADE' functionality?

I know you can use DBRef as a sort of foreign key but when the item in a collection where the reference points to is removed, the reference returns null. But i want that the item where the reference belongs to gets removed. How do i do this?

Or do i need every time i remove things check references to it?

解决方案

This feature doesn't exist now. If you want it. Add it on MongoDB Bugtracker

http://jira.mongodb.org

这篇关于MongoDB DBRef ON DELETE CASCADE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆