删除级联上的 MongoDB DBRef [英] MongoDB DBRef ON DELETE CASCADE

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

问题描述

在 MongoDB 中有没有办法让外键具有ON DELETE CASCADE"功能?

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

我知道您可以使用 DBRef 作为一种外键,但是当集合中引用指向的项目被删除时,引用返回 null.但我希望引用所属的项目被删除.我该怎么做?

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?

推荐答案

这个功能现在不存在.如果你想要的话.将其添加到 MongoDB Bugtracker

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

http://jira.mongodb.org

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

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