是否有可能从S3获取对象自定义元数据而无需获取整个对象?我查看了AWS SDK PHP 2并搜索了google和SO,没有明确的答案,或者可能只是我希望的答案.
谢谢.
下面使用匹配结果集的调用返回的结果不以文档 ID a4a6cf44-8a82-494a-a2b9-f6a3ec629f17 开头。正如下面的结果集所示,前 3 个键是相同的,但 startkey_docid 没有效果。
围绕这个只有几个问题
看法:
function (doc, meta)
{
if(meta.type == "json" && doc.type == "POST")
{
emit([doc.category, dateToArray(doc.created), doc.visibility], null);
}
}
Run Code Online (Sandbox Code Playgroud)
称呼:
?startkey=["auto",[2013,10,10,23,12,0],"EVERYONE"]&endkey=["auto",[2013,12,11,23,12,0],"EVERYONE"]&startkey_docid=a4a6cf44-8a82-494a-a2b9-f6a3ec629f17
Run Code Online (Sandbox Code Playgroud)
结果:
{
total_rows: 20,
rows: [{
id: "a4a6cf44-8a82",
key: ["auto", [2013, 11, 8, 1, 17, 46], "EVERYONE"],
value: null
}, {
id: "a4a6cf44-8a82-494a-a2b9",
key: ["auto", [2013, 11, 8, 1, 17, 46], "EVERYONE"],
value: null
}, {
id: "a4a6cf44-8a82-494a-a2b9-f6a3ec629f17",
key: ["auto", [2013, 11, 8, …Run Code Online (Sandbox Code Playgroud) 我一直在试图找出如何根据时间戳恢复数据.基本上我想基于时间戳字段查询100个文档.100个文档应该比我传递它的时间戳更旧.此外,我想创建一个刷新,我可以传递一个时间戳,我得到100个更新的文档.显然逻辑在这里会有所不同,但很难弄清楚Couchbase如何实现这一目标.
这是我到目前为止:
我的观点,正如你所看到的,我还需要使用复杂的密钥,因为我不仅要检查日期,还要检查我的可见性字段.我在视图的reduce部分没有任何内容.
function (doc, meta)
{
if(meta.type == "json" && doc.type == "POST" && doc.created != null)
{
emit([dateToArray(doc.created), doc.visibility], null);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在查询使用java客户端,将limit设置为2进行测试.这里有什么奇怪的是setDescending必须是false才能得到任何回报.我传递的日期也无关紧要我总能得到一个结果.我想要的预期行为是传递日期,只获得等于或早于日期的结果.
View view = client.getView("dev_posts", "post_list");
ComplexKey keys = ComplexKey.of(DataConstants.getDateAsArray(startDate), postType);
Query query = new Query();
query.setRangeStart(keys);
query.setIncludeDocs(true);
query.setLimit(2);
query.setDescending(false);
ViewResponse response = client.query(view, query);
Run Code Online (Sandbox Code Playgroud)
编辑:
基本上我从Couchbase寻找的东西类似于Facebook,Pintrest等移动应用程序.在用户刷新的给定时间戳上,我想获得更新的东西.当用户滚动时,我想让下一个组超过特定日期.
**更新**
所以这已经解决了,但是要进一步研究它.ComplexKey正在将我们的日期数组转换为"[2013,11,8,20,0,0]"而不是[2013,11,8,20,0,0].要进一步调查它.现在解决的办法是不使用ComplexKey,而是创建我们自己的复杂密钥,并将其作为密钥传递给startKey.
我正在尝试将Json数组反序列化为对象的ArrayList.我找到了一些关于我正在尝试做什么的文档,但是我在编译时遇到了错误.
以下是我试图用Jackson 2.2.2来解决它的方法:
ArrayList<Friends> list = objectMapper.readValue(result, new TypeReference<ArrayList<Friends>>() {});
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
The method readValue(String, Class<T>) in the type ObjectMapper is not applicable for the arguments (String, new TypeReference<ArrayList<Friends>>(){})
Run Code Online (Sandbox Code Playgroud)
我猜测我读过的一些参考文献是基于杰克逊的旧版本.如何在Jackson 2.2 +中实现这一目标
我要求在代码中手动生成令牌,并且第三方已经过验证.当我必须验证令牌时,我遇到了一个问题.我创建了自己的令牌存储,在不生成手动令牌时效果很好.我还扩展了DefaultTokenService,但只添加了一个方法.
我已经抛出几个断点,发现当我手动创建自己的令牌时,我正在点击ProviderManager类.但是当我没有创建自己的令牌时,我正在使用UnanimousBased类.不确定这个细节是否有帮助.要回溯它,但我对任何想法持开放态度.
以下是我创建令牌的方法:
ConcurrentHashMap<String, String> authorizationParameters = new ConcurrentHashMap<String, String>();
authorizationParameters.put("scope", "read");
authorizationParameters.put("username", "mobile_client");
authorizationParameters.put("client_id", "mobile-client");
authorizationParameters.put("grant", "password");
DefaultAuthorizationRequest authorizationRequest = new DefaultAuthorizationRequest(authorizationParameters);
Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
authorities.add(new GrantedAuthorityImpl("ROLE_UNTRUSTED_CLIENT"));
authorizationRequest.setAuthorities(authorities);
HashSet<String> resourceIds = new HashSet<String>();
resourceIds.add("mobile-client");
authorizationRequest.setResourceIds(resourceIds);
User userPrincipal = new User("mobile_client", "", true, true, true, true, authorities);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userPrincipal, null, authorities) ;
OAuth2Authentication authenticationRequest = new OAuth2Authentication(authorizationRequest, authenticationToken);
authenticationRequest.setAuthenticated(true);
NoSQLTokenStore tokenStore = new NoSQLTokenStore();
CustomTokenServices tokenServices = new CustomTokenServices();
tokenServices.setSupportRefreshToken(true);
tokenServices.setTokenStore(tokenStore);
OAuth2AccessToken accessToken = tokenServices.createAccessTokenForUser(authenticationRequest, …Run Code Online (Sandbox Code Playgroud) 假设我有一个User对象的ArrayList ArrayList<user>.User对象具有属性userID.
是不是自己迭代列表并将userID添加到单独的列表中,是否有API调用,我可以在其中传递我想要的属性,并将这些属性的列表返回给我?看看API并没有什么突出的.
在Java 7或<中寻找解决方案.