【发布时间】:2016-03-08 19:35:58
【问题描述】:
我正在使用 ektorp 1.4.1 Jar 连接到 Cloudant 数据库。现在我可以使用 EventRepository 类扩展 CouchDbRepositorySupport 来编写 map 和 reduce 函数。但我的问题是,如何使用 ektorp java API 查询索引和选择器?请任何人帮助我。提前致谢。
这是我的查询索引:
{
"index": {
"fields": [
{"name": "userName", "type": "string"}
]
},
"type": "text"
}
这是我的选择器代码,用于按用户名按 startDate 降序从 cloudant 获取所有事件。
{
"selector": {
"userName": "vekusuma@in.ibm.com"
},
"fields": [
"userName",
"startDate",
"days",
"_id",
"_rev"
],
"sort": [
{
"userName": "desc"
}
]
}
我正在使用下面的代码使用 Cloudant java API 连接 cloudant...
CloudantClient client = ClientBuilder.url(new URL("https://userName:password@*****.cloudant.com")).username("*******").
password("*******").build();
List<String> dbsList = client.getAllDbs();
System.out.println("...dbsList size is :: " + dbsList.size());
CloudantClient client = ClientBuilder.account("username").username("username").password("password").
build();
但还是同样的问题... 甚至我也尝试过不同的方式......
...我在本地的 Eclipse Websphere server 7.0 上运行时遇到下面提到的错误...
***********错误************* [3/9/16 23:53:43:547 IST] 00000031 SystemErr R com.cloudant.client.org.lightcouch.CouchDbException:400 错误请求:
400 错误请求
你的浏览器发送了一个无效的请求。 [3/9/16 23:53:43:548 IST] 00000031 SystemErr R 在 com.cloudant.client.org.lightcouch.CouchDbClient.execute(CouchDbClient.java:501) 请在这里帮我一些忙...提前谢谢:)【问题讨论】:
-
什么是完整的堆栈跟踪?您使用的是最新版本的 cloudant java 库吗?
标签: cloudant