vsam490
vsam490

Reputation: 89

cloudant nosql db query with regex

I have a cloudant nosql db with some records like this:

{
 "role": "utente",
 "nome": "Rocco",
 "cognome": "Di Vitto",
 "team": "sap pm-cs",
 "company": "wrestling",
 "appManager": "john Ford",
 "teamLeader": "Rendy Orton, Colombo M.R."
}

I would like to query my db with a $regex the teamLeader field, passing a single string that matches either with "Randy Orton" or "Colombo M.R." but I can't figure out the regex for matching two comma-delimited strings. I've tried reading Erlang queries structure but I didn't find the solution. Some help would be very useful. thanks in advance

Upvotes: 0

Views: 248

Answers (1)

vabarbosa
vabarbosa

Reputation: 706

when supplying regular expressions you should be using the $regex operator. have you tried something like this:

{
   "selector": {
      "teamLeader": {
         "$regex": "(Colombo M.R.)|(Rendy Orton)"
      }
   }
}

Upvotes: 2

Related Questions