我想知道执行相当于sql查询的mongodb查询的最佳方法是什么(从table1中选择_id,其中table1._id == table2._id)? [英] i want to know what is the best way to perform mongodb query equivalent to sql query (select _id from table1 where table1._id == table2._id)?

查看:238
本文介绍了我想知道执行相当于sql查询的mongodb查询的最佳方法是什么(从table1中选择_id,其中table1._id == table2._id)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mongodb.one中有两个集合有大约10万条记录,其他有10万条记录(两个集合都有_id字段)。我想知道执行mongodb查询等同于sql查询的最佳方法是什么(选择_id from table1 where table1._id == table2._id)?

我尝试通过将结果从一个查询传递到另一个查询来使用$ in但是如果first的查询结果大于第二个查询,则会失败。

i have two collections in mongodb.one is having around 10 lakh records other has 1 lakh records(Both collection have _id field).i want to know what is the best way to perform mongodb query equivalent to sql query (select _id from table1 where table1._id == table2._id)?
I have tried using $in by passing results from one query to another query but it fails if query result of first is greater than the second.

推荐答案

将结果从一个查询传递到另一个查询,但如果查询结果的第一个大于第二个查询,则会失败。
in by passing results from one query to another query but it fails if query result of first is greater than the second.


这篇关于我想知道执行相当于sql查询的mongodb查询的最佳方法是什么(从table1中选择_id,其中table1._id == table2._id)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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