Home > Database > Mysql Tutorial > MongoDB之DBref(关联插入,查询,删除) 实例深入

MongoDB之DBref(关联插入,查询,删除) 实例深入

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:03:56
Original
1373 people have browsed it

如图所示,A,B,C三个Collection互相关联。 其中的数字为document的value值。

如图所示,,A,B,C三个Collection互相关联。 其中的数字为document的value值。

关于DBref的入门可以看 这篇文章。

我们先建立A collection。

B collection以A collection的  _id为ObjectId("4e3f33de6266b5845052c02c")作为Apid

所以:

C collection以B collection的  _id为 ObjectId("4e3f3de16266b5845052c036") 作为Apid

目前为止3个collection 的关系已经建成。

查询

 

  • 其实好好想想引用不是必须的。

    MongoDB 权威指南说了这么一句:

    In short,the best time to use DBRefs are when you're storing heterogeneous references to documents in different collections.like when you want to take advantage of some additional DBRef-specific functionality in a driver or tool.

    linux

  • Related labels:
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Issues
    mongodb start
    From 1970-01-01 08:00:00
    0
    0
    0
    linux - ubuntu14 error installing mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    Use of symfony2 mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    mongodb _id rename
    From 1970-01-01 08:00:00
    0
    0
    0
    Parameter understanding of mongodb
    From 1970-01-01 08:00:00
    0
    0
    0
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template