本文介绍了服务器上的Couchbase N1QL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了在线 N1QL教程来练习编写查询.现在,我已经拥有了一个自己的Couchbase服务器,我想查询自己的数据.

I used the online N1QL tutorial to practices writing queries. Now that I have a couchbase server of my own, I want to query my own data.

我可以在Couchbase服务器的哪里写查询?

Where in the Couchbase server can I write my queries?

谢谢

推荐答案

请记住,N1Q1仍处于Beta中.

Remember that N1Q1 is still in Beta.

它的工作方式是您必须运行Couchbase Query Server(又名CBQ).它在默认端口8093中运行(请参阅 N1QL )查询服务器将连接到指定的Couchbase实例/群集.例如

The way it works is that you have to run Couchbase Query Server (aka CBQ). It runs in a default port 8093 (see N1QL) The query server will connect to the specified Couchbase instance/cluster.e.g.

cbq-engine -couchbase <CB-location>

一旦CB查询引擎启动并运行,您就可以运行命令行客户端,并且在命令提示符下可以发出您的N1QL语句,例如:

Once CB Query Engine up and running you can run command line client and in a command prompt can issue your N1QL statements, e.g.:

cbq -engine http://your-cb-host:8093/

cbq> SELECT 'Hello World' AS Greeting
{
    "resultset": [
        {
            "Greeting": "Hello World"
        }
    ],
    "info": [
        {
            "caller": "http_response:160",
            "code": 100,
            "key": "total_rows",
            "message": "1"
        },
        {
            "caller": "http_response:162",
            "code": 101,
            "key": "total_elapsed_time",
            "message": "4.0002ms"
        }
    ]
}

这篇关于服务器上的Couchbase N1QL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 02:53