offsetsOf
ReQL command: offsetsOf
Command syntax
sequence.offsetsOf(datum | predicate_function) → array
Description
Get the indexes of an element in a sequence. If the argument is a predicate, get the indexes of all elements matching it.
Example: Find the position of the letter ‘c’.
r.expr(r.array("a", "b", "c")).offsetsOf("c").run(conn);
Example: Find the popularity ranking of invisible heroes.
r.table("marvel").union(r.table("dc")).orderBy("popularity").offsetsOf( row -> row.g("superpowers").contains("invisibility") ).run(conn);
Get more help
Couldn't find what you were looking for?
- Ask a question on Stack Overflow
- Chat with us and our community on Slack
- Talk to the team on IRC on #rethinkdb@freenode.net — via Webchat
- Ping @rethinkdb on Twitter
- Post an issue on the documentation issue tracker on GitHub
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/java/offsets_of/