How to model nested attriubtes?

Hello!

In mongo it is common to use embedded types instead of a relation on another table. For example,
a Contact type that has an embedded address.

{
  ...contact,
   address: {
       street: 124 xyz,
       zip: 28822
  }
}

How do you model this in strapi?

Help would be much appreciated, really struggling to figure this out from the docs. Thanks!

Hi @hainessss

Currently we don’t support MongoDB’s nested documents, it’s something we may entertain in the future, but at the moment MongoDB is treated as a relational database.

1 Like

I have a client with a database architecture already in production like this.

They want to be able to edit a nested field, similar to OPs “street” property, from the admin panel. I know you say Strapi doesn’t support nested documents. Is there any workaround for this? Would it be possible to create a custom query and have that reflected as a content-type in the admin panel?

@ZeeEssDoubleU since we are planning to drop support for MongoDB entirely it’s unlikely. As of the Strapi v4 you won’t be able to use MongoDB anymore until they build their own connector which has no ETA.

1 Like

I see. Thank you for the quick reply.

@DMehaffy, is there an estimation for how long V3 will be maintained?

I believe about 6 months after the stable v4 release, security updates only.

1 Like