0

While executing a CouchDB query with the $in option , it results in error.

400 Client Error: Bad Request bad_arg Bad argument for operator $in: <<91,,,107,34,93>>

The query being used is

{u'$and': [{u'messageContent.component': {u'$in': 
u'["AccountMock","AccountMock"]'}}, {u'messageContent.teamId': {u'$in': 
u'["mockteam-3-1","123"]'}}, {u'messageContent.userId': {u'$in': 
u'["mockuser-3-1","mockuser-2-1"]'}}, {u'messageContent.messageType': 
{u'$in': u'["Creating Mock Account","Creating"]'}}, 
{u'messageContent.subcomponent': {u'$in': 
u'["CreateAccountMock","Create Account"]'}}]}

Please suggest ways to get over this.

James Z
  • 12,209
  • 10
  • 24
  • 44
Raj
  • 1
  • Have you tried to use curl for testing? just to discard a python JSON composition issue. This looks strange u'["Creating Mock Account","Creating"]', it should be an array not an unicode string – Juanjo Rodriguez May 23 '18 at 16:46
  • Yes, did try the curl too. but no luck. – Raj May 23 '18 at 17:13
  • The above unicode string is being converted to the following on doing json.dumps() {"$and": [ {"messageContent.component": {"$in": ["AccountMock","AccountMock"] }}, {"messageContent.teamId": {"$in": ["mockteam-3-1","123"] }}, {"messageContent.userId": {"$in": ["mockuser-3-1",'mockuser-2-1"] }}, {"messageContent.messageType": {"$in": ["Creating Mock Account","Creating"] }}, {"messageContent.subcomponent": {"$in": ["CreateAccountMock","Create Account"] } } ] } – Raj May 23 '18 at 17:31
  • Here ["mockuser-3-1",'mockuser-2-1"] there is a ', it is correct? – Juanjo Rodriguez May 25 '18 at 12:08

0 Answers0