Is it possible to populate data using data api?

I’m not able to find anything in the documentation related with population using the Data API from Mongo Atlas.

I’m doing something like this, but not working:

const body = JSON.stringify({
    ...connectionData,
    filter: {
      status: true,
      catalog: true,
      slug,
    },
    populate: 'taxes',
    collection: 'products',
    projection,
  });

Hi @Andres_Filoso - Welcome to the community.

Just to clarify, are you referring to just inserting data into a collection? Maybe the Data API examples for inserting a document may help.

Regards,
Jason

Hi @Jason_Tran.

No. Actually, I was looking to use $lookup to “populate” documents from another collection. I was able to accomplish this by using the pipeline field and removing the filter and projection fields.

https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/aggregate

Also here is an example of how to use it.

Thank you! :slight_smile:

1 Like

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