Forum Discussion

shubhimu's avatar
shubhimu
Contributor
6 years ago

Mongo Db query not working in JDBC TestSTep of Ready API

Hi,

 

I am able to connect to mongo db after placing the mongodb_unityjdbc_full driver in ext folder.

But i am not sure how i can run query from jdbc test step.

I tried following the mongo db syntax but its throwing below errror message:

2018-12-26 07:25:54.543 - Error getting response; java.sql.SQLException: Parse Exception: unity.parser.ParseException: Encountered " "(" "( "" at line 1, column 17.
Was expecting:
";" ...
Input query: db.customer.find({leadId:"83863270"},
{accountState:1,leadId:1,_id:0});

 

Can someone please help me how i can place query under sql query section of jdbc test step for mongo db ?. Please see the image for your reference

3 Replies

  • shubhimu

    please try using simple sql query once test connection get success. 

    Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.Smiley Wink

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi shubhimu,

       

      Did any suggestions help you? Please give Kudos to their authors and accept a solution if the question is resolved.

  • richie's avatar
    richie
    Community Hero
    Hey,

    In the absence of any other responses im gonna respond but i cant really help as i have minimal nosql db experience.

    The response youre getting appears to indicate it doesnt like the syntax of your query....youre definitely connecting ok.

    You appear to be using the standard collection find method. The only thing i can suggest at this point is simplyfying your query further. After a bit of reading it appears you are querying for a record with certain leadid and additional filters on your query. Have you tried the simplest query you can do? e.g. to find a record in the customer collection where leadid = "83863270"?

    I'll do a bit more reading to see if i can see anything but id start at this point if i were you. Simplest query possible. I know years ago a version of soapui didnt like ; to finish an oracle query, but this was how you ended your query in oracle!


    One thing. The first leadid value is being treated as a string (the double quotes) but the second leadid attribute value is treated as numeric (no double quotes wrapping the second leadid value). Is this correct?

    Cheers,

    Richie