I am new to MongoDB Realm, however had some experience with MongoDB.
Before any comments about the same problem, I already have been to all discussions and nothing have helped me yet.
I have consulted these discussions:
Android BAD_CHANGESET(realm::sync::ProtocolError:212): Bad changeset (UPLOAD) Error
Keep getting BadChangeset Error
But sadly, either the mentioned solutions doesn’t work for me or I am not able to understand those.
I am currently using Realm in Nodejs. I have partition key as restroName while activating sync. But constantly I keep getting 212 error while I connect using:
const realm = new Realm({
schema:[ItemSchema],
sync:{
user:user,
partitionValue: user.id,
}
})
failed to validate upload changesets: SET instruction had incorrect partition value for key “restroName” (ProtocolErrorCode=212)
When I try to use partionValue: “anything”, it gives:
user does not have permission to sync on partition (ProtocolErrorCode=206)
So I assume it needs to be the user.id on the partitionValue but I want to store data in the realms with restroName.
Also I always clear the realm data (wipe it) before I make changes.
I hope I can get help.
Update: My Item Schema looks like this:
const ItemSchema = {
name: "item",
properties: {
_id: "objectId",
restroName: "string",
details: "string?",
name: "string?",
status: "string?",
price: "string?"
},
primaryKey: '_id'
}
The problem raised because I messed partitionKey as user id and restroName. The way I solved it was I kept the partitionKey as restroName and under permissions I kept the template none and set partitions for read and write in realm as :
I consulted here to enable custom data.