Handling Schema Changes

7 views
Skip to first unread message

Sahil Chimnani

unread,
Feb 28, 2020, 9:09:18 AM2/28/20
to mongodb-go-driver
How to handle if document structure after production changes.

Suppose I had 500 documents like this:
{
name : 'n1'
height : 'h1'
}

Later if I decide to add all the documents in below format:
{
name : 'n501'
height : 'h501'
weight : 'w501'
}

I am using cursor.All(&userDetails) to decode(deserialize) in GoLang to get the output of the query in struct userDetails. If I modify the structure of further documents and userDetails accordingly, it will fail for the first 500 documents?

How to handle this change?







Divjot Arora

unread,
Feb 28, 2020, 10:21:29 AM2/28/20
to mongodb-go-driver
Answered in https://community.mongodb.com/t/managing-schema-changes-with-mongodb/1137. For future reference, we are hoping to move all Google Group communication to the community forums, so it's sufficient to just ask the question there rather than both places. 
Reply all
Reply to author
Forward
0 new messages