简体   繁体   English

一次查询多个collections(mongodb)

[英]Query on multiple collections at once (mongodb)

I'm not pretty sure could I do this.我不太确定我能做到这一点。 My application(buy and sell) have around five to ten categories eg: vehicles, real estate, and cloths I thought of creating separate MongoDB collections for each category because each of the categories contains with different fields eg: vehicle[km, body type, brand], cloths[size, color, gender] , This would be very easy to manage and scale.我的应用程序(买卖)大约有五到十个类别,例如: eg: vehicle[km, body type, brand], cloths[size, color, gender] eg: vehicles, real estate, and cloths eg: vehicle[km, body type, brand], cloths[size, color, gender] ,这将非常容易管理和缩放。

Now can I able to send one query to those multiple collections at once现在我可以一次向多个 collections 发送一个查询吗

  1. sort new ads - sort all new ads from all multiple collections in order排序新广告 - 按顺序对所有多个 collections 中的所有新广告进行排序
  2. text search on field eg: title on all collections字段上的文本搜索, eg: title

server: nodejs服务器:nodejs

MongoDB 4.2 introduces wildcard indexes specifically for this use case. MongoDB 4.2 专门为此用例引入了通配符索引

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM