Query Meta.id with regex

document id are formed in the following fashion:


First, I read id is indexed and faster to query. so thinking of querying for orders for a specific product (say all orders for product id 123). I tried the following but it is not working:

    String regexId = "\\border_" + productId + "_.*\\b";
   Expression exp = Expression.property("id").regex(Expression.string(regexId));

but it finds no documents but i am sure there are documents. What am I doing wrong? While I intend to measure the performance, is there an advantage already to using the id field?

First, confirm that the document actually exists by doing a directly lookup by document Id.

To query for documents with Ids matching a certain criteria, you’d use something like this.

let searchQuery1 = QueryBuilder
                SelectResult.expression(Expression.property("name"))        )

thanks…worked like a charm!