Add default mapping to existing mongodb collection

I am trying to add default collation to my mongodb collections. Just create a new collection sorted:

db.createCollection(name, {collation:{locale:"en",strength:1}})

      

Unfortunately I went through the docs and didn't see any feature db.updateCollection

. How can I add sorting without destroying and recreating all my documents in a new collection?

+3


source to share


1 answer


From collation specification,

After the first release of version 3.4 of the server, many users will want to apply Collations to all operations in an existing collection. such users will have to provide a collation explicitly for each operation; however, ultimately most users wanting to use Mappings across all operations in a collection will create a collection with the default server side. We decided to support custom verbosity right now by abstracting the function for short term benefits.



This means that you do not yet know its version.

+4


source







All Articles