简体   繁体   中英

How to rename a document property in Cosmos DB?

Is it possible to rename a property like in MongoDB, using C# SDK or migration tool?

I didn't see any example about it

DocumentDB is schemaless. There is no structure defined outside documents themselves so each document has their own schema. Hence you cannot rename a property outside of your documents themselves.

What you can and should do, is to fix documents which you consider having wrong schema by updating them. Query docs which have the wrongly named property, rename the property in the documents with you application logic, and update them to DocumentDB collection.

Yes.If I read/modify/replace the old property Will still be stored

I can only assume this must be some mishap in your application logic. If not, then you should provide a minimal verifiable repro case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM