I'm trying to return a partial set of results using range()
for pagination in my app. I need to also return the total number of records in the overall result as part of the response. A response should look like:
{
postcount: 239,
posts: [
{
postID: 1,
postTitle:'First post'
},
{
postID: 2,
postTitle:'Second post'
},
{
postID: 3,
postTitle:'Third post'
}
]
}
I've been trying to make something like this work with no luck:
g.V().hasLabel('post').as('postcount','posts').select('postcount','posts').by(__.count()).by(__.range(0,2).valueMap())
That appends a postcount = 1
property to each item. How do I adjust this?