BadPiggie
BadPiggie

Reputation: 6379

Implementing Mongo Atlas Search on a Document that has dynamic properties

I am having trouble implementing an Atlas Search on a document collection where the documents have no fixed field names. All the field names are highly dynamic.

For Example, A user may create a document with the following fields

{
  name: string,
  description: string
}

Another user may create a document with the following fields

{
  company: string,
  username: string
}

This is happening because we provide a feature to users where they can create their own records. So the fields are also dynamic depending on their needs. No, we need to provide Full-Text Search Support on these documents but we are struggling to create a Search Index because the path is dynamic.

Is there any way in Mongo Atlas Search to accomplish this?

Upvotes: 1

Views: 1146

Answers (1)

Tom Slabbaert
Tom Slabbaert

Reputation: 22316

Yes, when you define the collections [field mapping] you want to define it as dynamic:

You can configure Atlas Search to automatically index all the supported field types in the collection using dynamic mappings.

There are some limitations by doing this but it does not sounds like it will affect you.

You then can execute a wildcard field search

Upvotes: 2

Related Questions