使用Mongo DB API需要帮助(查询中的$表现不同) [英] Help needed using Mongo DB API ($in query behaving differently)

查看:73
本文介绍了使用Mongo DB API需要帮助(查询中的$表现不同)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


当我运行以下查询时,我在cosmos DB集合中有两组数据:


< span style ="background:yellow"> {'applicationType':'Highbay','制造商':{'$ in':['bst']}}


我得到满足条件的所有记录 


但是,如果我运行以下查询


{'applicationType':'AreaLight','制造商':{'$ in':['bst']}}


我没有得到任何数据,尽管我有100多个这样的记录。 PS:当我删除$ in运算符并使用类似:
{'applicationType':'AreaLight','manufacturer':'bst'},它给了我数据。


请告诉我可能出现什么问题?


PS:我有 MongoDB 3.4线协议(版本5)和  启用聚合管道

解决方案

< blockquote>

您好,


感谢您的反馈。你能不能分享你的Highbay和AreaLight对象的结构。


这样我们就可以确定为什么'


'中的' 'AreaLight'。


如果需要,您可以参考以下链接获取有关'


的更多信息:


https://docs.mongodb.com/manual/reference/operator/query/in/



问候


Anurag 





Hi,

I have two sets of data in a cosmos DB collection , when I run the following query:

{'applicationType': 'Highbay','manufacturer':{'$in': ['bst']}}

I get all the records that satisfy the criteria 

However, if I run the below query

{'applicationType': 'AreaLight','manufacturer':{'$in': ['bst']}}

I do not get any data, though I have 100s of such records. PS: When I remove the $in operator and use something like: {'applicationType': 'AreaLight','manufacturer':'bst'}, it gives me the data.

Please let me know what could be the issue?

PS: I have MongoDB 3.4 wire protocol (version 5) and Aggregation Pipeline enabled

解决方案

Hi,

Thanks for your feedback. Could you please share the structure of your Highbay and AreaLight objects.

So that we can identify why '


in' is not working in case if 'AreaLight'.

You can refer below link for more information on '


in' operator if needed:

https://docs.mongodb.com/manual/reference/operator/query/in/

Regards

Anurag 


这篇关于使用Mongo DB API需要帮助(查询中的$表现不同)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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