作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
回到经典的 mongodb 示例(帖子和用户):
帖子:
{title: "Greetings", body:"Hello world", userId:12345}
用户:
{_id:12345, name:"John Smith", email:john@smith.org"}
如何获取帖子
{title: "Greetings", body:"Hello world", <username>:"John Smith"}
用一个单一的查询?
最佳答案
MongoDB 不是 RDBMS - 所以没有 JOINS - 要么使用两个查询,要么使用嵌入,要么查看“数据库引用”。
关于mongodb - 一对多关系 : retrieving documents with a single query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4873974/
我是一名优秀的程序员,十分优秀!