The "_id" attribute is a composition of collection name, the "/" and the
document "_key" attribute.
That means "_id" is a string with the same prefix for all documents in
the same collection.
It would be better to filter on "_key" instead, because it is shorter
and does not contain the always-same prefix, just the document key that
you assigned (or the database assigned) when the document was created.
The "_key" attribute is a string. If you don't assign a "_key" value
yourself, the database will create one for you. The "_key" values the
database creates as numeric values that will be ever-increasing. Newer
documents will get higher numeric values than older ones.
However, as you can mix your own keys with database-assigned keys, the
"_key" attribute is still a string.
Sorting on "_key" will do a string sort, and this causes the usual
problems (e.g. "2" > "100"). If you want the treat keys as numbers and
sort by that, you need to convert them to numbers first and then sort.
That might not be efficient and might not work if you use any
non-numeric keys.
In the end, filtering on "_key" using equality should be efficient, but
any other operations on "_key" with cannot use equality checks (such as
range comparisions, sorting) are probably not "right".
From my point of view it will make sense to eventually add some
attribute or functions which can be used to retrieve documents in
insertion or update order. That might solve a lot of practical problems.
Best regards
Jan
> --
> 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
arangodb+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.