wildcard Search with cts.fieldValueMatch for dateTime datatype

Viewed 60

I have used FieldValueMatch to do wildCard search for dateTime datatype, but its throwing an error when I use the pattern same as string

cts.fieldValueMatch("submittedOn", "2020*", ["case-insensitive"], cts.collectionQuery("customers"))

Am I using the pattern in the wrong way? Can someone please suggest

1 Answers

Is this the error that you are getting?

[javascript] XDMP-ARG: cts.fieldValueMatch("submittedOn", "2020*", "case-insensitive", cts.collectionQuery("customers")) -- arg2 is invalid

You are querying with a string pattern.

$pattern A pattern to match. The parameter type must match the lexicon type. String parameters may include wildcard characters.

In order to be able to perform a wildcarded string value match, you need to have a string range field index on that submittedOn field. You can have multiple indexes on the same field.

Related