简体   繁体   中英

Java: How to retrieve all documents from specific bucket of couchbase server?

I am trying to retrieve all documents from my local couchbase server. I have created one bucket as named "student" but it just show opened bucket and give build successful message nothing happen beyond that,i am expecting list of all documents.

Cluster cluster = CouchbaseCluster.create();
        Bucket bucket = cluster.openBucket("student");
        N1qlQueryResult result = bucket.query(N1qlQuery.simple("SELECT * FROM `student`"));

        for (N1qlQueryRow row : result) {
            String Name = row.value().getString("name");
            System.out.println(Name);
        }

听起来好像您想从本地服务器上创建的存储桶中检索所有文档。您可以做一件事引用链接 ,在完成所有步骤之后,只需在终端上运行以下命令,这可能对您有所帮助

create primary index on `beer-sample`;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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