How to read a json array and nested json elements using Mongocxx driver

Suppose if the data in db as shown below:
{“title”:“The Adventures of Tom Thumb & Thumbelina”,“director”:“Niccolo Bris”,“actors”:[“Lonni Fulger”,“Benedetto Jeandeau”,“Sylvester Argyle”],“release_year”:{“$date”:“1999-09-09T11:50:02.000Z”},“genres”:[“Musical”],“gross”:1015338,“runtime_min”:60,“ratings”:{“soft_avocados”:12,“mndb”:7,“votes”:2014}}

  1. How to read ratings->soft_avocados and actors array element using mongocxx driver?
  2. How to check if element/array/object exists or not using mongocxx?

Where can I find the example code snippets about different bson types.

Will be really helpful if someone comes up with a solution.

There are examples & tutorials available here:

For your question specifically, please take a look at this:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.