是否可以针对 noSQL DB 构建复杂的查询 [英] Is it possible to construct complex queries against noSQL DB

查看:61
本文介绍了是否可以针对 noSQL DB 构建复杂的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究 noSQL DB,但一直无法为自己满意地回答这个问题:是否可以针对 noSQL DB 构建复杂的查询?

I have been researching noSQL DB and have not been able to satisfactorily answer this for myself: Is it possible to construct complex queries against noSQL DB?

我想知道的查询类型是这样的:

The type of query I'm wondering about would be something like this:

select * from DB where
vara > x AND
varb = 2 AND
varc < x AND
vard in (x,y,z) AND
vare like '%texthere%' AND
varf = 2 AND
varg = 3 and
etc...

注意:我知道我不能使用 SQL,如上所述,我要问的是如何使用上面的伪逻辑进行查询,换句话说,就是一堆不同的条件.到目前为止,我发现的最佳答案是您有一个 RDBMS 可以查询,然后根据云中的密钥抓取数据.对我来说,这不一定更有效.

NOTE: I'm aware that I can't use SQL, as above, what I'm asking is how would I query using the psuedo logic above, in other words a whole bunch of different conditions. So far the best answer I have found is that you have an RDBMS to query and then grab data based on key from cloud. That doesn't necessarily seem more efficient to me.

所以作为跟进.如果只是想解决搜索 400 万行"问题而不是我们有数十亿行数据"的问题,我是否应该费心查看 noSQL 数据库?

So as a follow up. If just trying to solve a 'search 4 million rows' problem as opposed to a 'we have billions of rows of data' problem, should I even bother looking at a noSQL DB?

推荐答案

mongodb 中,你只需要做类似于 db.mytbl.find({"vara": { $gt: 10}, "varb": 2, "varc": {$lt: 100 }})

In mongodb, you would just do something like db.mytbl.find({"vara": { $gt: 10}, "varb": 2, "varc": {$lt: 100 }})

请参阅此处此处 示例

这篇关于是否可以针对 noSQL DB 构建复杂的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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