Stack Overflow Asked by rohini on November 18, 2021
Original Code:
CosmosPagedIterable familiesPagedIterable = container.queryItems(
"SELECT Family.id FROM Family", queryOptions, Family.class);
familiesPagedIterable.iterableByPage(10).forEach(cosmosItemPropertiesFeedResponse -> {
System.out.println("Got a page of query result with " +
cosmosItemPropertiesFeedResponse.getResults().size() + " items(s)"
+ " and request charge of " + cosmosItemPropertiesFeedResponse.getRequestCharge());
System.out.println("Item Ids " + cosmosItemPropertiesFeedResponse
.getResults()
.stream()
.map(Family::getId)
.collect(Collectors.toList()));
});
Above code prints all the entires in the items, what I want is to get the item id present in Family, without any Family model class created in java. Trying to get the items id for all the container present in the database
Please try something like this:
CosmosPagedIterable<String> familiesPagedIterable = container.queryItems("select value c.id from c",queryOptions, String.class);
familiesPagedIterable.iterableByPage(10).forEach(cosmosItemPropertiesFeedResponse -> {
System.out.println("Got a page of query result with " +
cosmosItemPropertiesFeedResponse.getResults().size() + " items(s)"
+ " and request charge of " + cosmosItemPropertiesFeedResponse.getRequestCharge());
System.out.println("Item Ids " + cosmosItemPropertiesFeedResponse
.getResults()
.stream()
.collect(Collectors.toList()));
});
Answered by Steve Zhao on November 18, 2021
0 Asked on February 8, 2021 by jbuddy
1 Asked on February 8, 2021 by thomedy
1 Asked on February 7, 2021 by l0raxeo-c
2 Asked on February 7, 2021 by jonna_983
1 Asked on February 7, 2021 by lo-tolmencre
2 Asked on February 7, 2021 by pikachu-sir
1 Asked on February 7, 2021 by ahmad-nur-hasybi
2 Asked on February 7, 2021 by nje
0 Asked on February 7, 2021 by user14848693
0 Asked on February 7, 2021 by vatsal-jain
0 Asked on February 7, 2021 by shiasu-sama
1 Asked on February 7, 2021 by ayy__bee
1 Asked on February 7, 2021 by ben-leggiero
2 Asked on February 7, 2021
android android constraintlayout android gradle plugin android studio material components android
2 Asked on February 7, 2021
2 Asked on February 7, 2021
1 Asked on February 7, 2021 by dovizu
8 Asked on February 7, 2021 by koeradoera
1 Asked on February 6, 2021 by tapas-mukherjee
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP