True, changing environment after deployment will not change your database. These values are for deployment with realm-cli. On the other hand, you can deploy multiple versions of the same app to the same project, each with any environment/database you want.
I’m using it like below, no problems with partition based sync (haven’t tried flexible).
relationships.json
{
"previousContext": {
"ref": "#/relationship/mongodb-atlas/%(%%environment.values.database)/ReportingContexts",
"source_key": "previousContext",
"foreign_key": "_id",
"is_list": false
}
}
rules.json
{
"collection": "ReportingContexts",
"database": "%(%%environment.values.database)",
"roles": []
}