I cam across this entry: https://github.com/arangodb/arangodb/issues/5359
Seems to do what I want. And the way I read it, the only real problem with it is when there's a large amount of documents But my use case (displaying of search results) limits the maximum number of documents to a configured amount (e.g. 10k). Anything more than that and the user will only get the first 10k and an information message saying they have to refine their search criteria. Thoughts? On Friday, September 28, 2018 at 1:12:04 AM UTC-5, Max Neunhöffer wrote: > > Hi, > there are two reasons why we hesitate to offer this functionality. One is > the cluster, which you have mentioned. The other is that AQL intentionally > has no mutable state (variables) because it is a descriptive language and > for example does not guarantee any order in FOR statements. This allows > more optimizations, in particular in a distributed system. > However, in a sense we do offer what you want, since we provide a list of > results. So client side, you can easily add a sequence number simply by > taking the index in the list. With batches you would have to keep a total, > but this is usually no problem at the client side. > Furthermore, you could have a little Foxx app, which does what you want by > playing exactly that trick. You might have a little trouble keeping the > state from one batch to the next, but this could for example also be done > client side by having a count in the API. > Cheers, > Max > > Am 28. September 2018 05:26:00 MESZ schrieb [email protected] > <javascript:>: > >Hi, > > > >Is there a rownum function to be able to assign a row number to every > >record returned from a query? > > > >Say I have two documents: {fname: fname1, lname: lname1} and {fname: > >fname2, lname: lname2} > > > >Is it possible to do something of the sort and get the output like > >below? > > > >for d in mycoll > >return {myrownnum: ROW_NUMBER(), fname: d.fname, lname: d.lname} > > > >Expected output: > > > >{myrownum: 0, fname: fname1, lname: lname1} > >{myrownum: 1, fname: fname2, lname: lname2} > > > >I understand that it would probably not work (i.e. would give wrong > >rownums > >or plainly not work) in a clustered environment and that you haven't > >specified the shard keys completely. But I think it should b possible > >when > >you hit a single shard. > -- You received this message because you are subscribed to the Google Groups "ArangoDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
