You can translate the question and the replies:

RETRIEVE SPECIFIC DOCUMENTS - MongoDB Custom Wrapper

Hi, I am trying to retrieve specific documents from a collection in mongodb database using the MongoDB wrapper. In my collection, I have 3 documents, 2 with year = 2017 and one with year = 2018, my query in mongoDB compass i s working ==> { "Message.Body.Template.Informations.Year" : "2017" } In denodo, I tried to create my introspection query as below with the braces : \{"Message" :\{"Body" :\{"Template" :\{"Informations" :\{"Year" : "2017" \}\}\}\}\} I used the documentation https://community.denodo.com/docs/html/document/denodoconnects/8.0/en/Denodo%20MongoDB%20Custom%20Wrapper%20-%20User%20Manual# but I get this error : com.denodo.vdb.interpreter.execution.DescDataSourceAction [] - Error loading custom wrapper: Error while executing custom wrapper method 'getSchemaParameters': MongoDB wrapper error. Introspection query does not retrieve any document What to do to get only specific documents when creating the base views? Thank you
user
01-03-2023 06:06:32 -0500
code

4 Answers

Hi, In this case, MongoDB has a specific syntax when it comes to escape braces. Before a brace should always be a slash. For example: \ { "properties": \ {"LINEARID": "1101121687137", "observed": "", "COUNTYFP": "051", "RTTYP": "M", "FULLNAME": "Airport Rd", "MTFCC": "S1400", "STATEFP": "35" \ } \ }. More about this you can find in the [User Manual of the MongoDB Custom Wrapper](https://community.denodo.com/docs/html/document/denodoconnects/8.0/en/Denodo%20MongoDB%20Custom%20Wrapper%20-%20User%20Manual#:~:text=If%20you%20don%E2%80%99t%20want%20to%20explicitly%20define%20the%20schema%2C%20you%20should%20use%20the%20Introspection%20query%C2%A0parameter.%20For%20this%20you%20should%20use%20a%20query%20over%20the%20collection%2C%20following%20the%20syntax%20for%20the%20mongodb%20method%20db.collection.find). I hope this helps!
Denodo Team
02-03-2023 04:18:29 -0500
code
Hi, Thank you for the answer but I am already using the slash, I don't know why it dessapers when posting my questions so that's not the problem here, and I already red the documentation. Hope you can give me another answer for this problem beacause I am just doing what the documentation said but it's not working... Thank you
user
02-03-2023 04:24:18 -0500
Hi, When you tried to create the base view, did you also provide the collection name? This is needed in addition to the introspection query. Apart from that, does it work for you when defining the fields as explained in the user manual instead of the introspection query? If yes, you could create the base view like that and have a selection view on top to filter for specific values. If all of that is still not working, this looks to be an issue that needs deeper analysis. If you have a valid support user, you may want to contact the [Denodo Support](https://support.denodo.com/) which will be able to better assist you. Hope this helps!
Denodo Team
02-03-2023 05:27:31 -0500
code
Hi, Yes I put the collection name, and the introspection query when creating the base view. From my understanding, the field is used to specify the schema of the baseview while the intrspection query is to filter over specific documents of the collection. My documents have different schema, for this reason I am trying to filter over them when creating my base view, because If I dont do this I will have types error after that.. Thank you for your help
user
02-03-2023 05:34:00 -0500
You must sign in to add an answer. If you do not have an account, you can register here