@Barry_Fawthrop Thanks - Have you tried statically setting the partition and username field as a hard-coded string rather than passing it in from Globals?
@Ian_Ward
No, iOS works well and I can save/create the record with iOS. iOS has no issues and no errors
this is purely creating a document with Android/Kotlin it creates the local document as reading the local DB has the new field. But it does NOT sync to Realm Server NOR to the Atlas Collection
and thus other devices.
I made username a static string still same error
BadChangeset Error Aug 23 9:41:17-04:00 1ms SyncWrite -- [5f26c54b0cd4c10a409dcffb](https://realm.mongodb.com/groups/5c253dffc56c98059b6dafd0/apps/5f26c046a42e1c43ea410c9c/logs?user_id=5f26c54b0cd4c10a409dcffb)
[5f4271fddfc779089e764ca1](https://realm.mongodb.com/groups/5c253dffc56c98059b6dafd0/apps/5f26c046a42e1c43ea410c9c/logs?co_id=5f4271fddfc779089e764ca1)
Error:
failed to validate upload changesets: instruction had incorrect partition value for key "username" (ProtocolErrorCode=212)
Partition:
barryf@ttienterprises.org
@Barry_Fawthrop Strange - would you be willing to send me the app so I could repro and figure out what is going wrong? You can email me at ian.ward@mongodb.com
But in the runtime the object/realm is seemingly valid and throws no errors.
If you try to make changes in a write block, no changes get committed and the last message AFTER you’re all done is:
I’m using dev mode, not manually managing _partition and leaving that up to realm to manage internally and the schema has not changed on the client side.
I don’t seem to get consistent behaviour on every run either. I’m pulling my hair out.
I think I’m running into a similar issue here, but with Android. I’m using a key “author” as the partition value. When I log the author of every object I’m trying to synch, they all match the partition. but
I still get this on the server logs. I’ve tried terminating synch and restarting, wiping the simulator, etc.
Error: failed to validate upload changesets: instruction had incorrect partition value for key “author” (ProtocolErrorCode=212)
Partition: 5f4c4cca4ae5e33550354328
Write Summary: {
“Recipe”: {*
“inserted”: [*
"5f4c4cdd9933dd503e2804d1"*
]*
}* } SDK: android v10.0.0-BETA.5
Platform Version: 11
Is there any timeline on the added logging mentioned by @nirinchev ? This would be very helpful.
@Ryan_Goodwin Can you share your android model and the code for inserting an object? Notably, I’m interested in seeing if you’re using createObject or copyToRealm.
open class Recipe : RealmObject() {
@PrimaryKey open var _id: ObjectId? = ObjectId()
open var title: String? = null
open var author: String = ""
var ingredients: RealmList<Ingredient> = RealmList()
var directions: RealmList<Direction> = RealmList()
}
open class Direction : RealmObject() {
@PrimaryKey open var _id: ObjectId = ObjectId()
open var text: String = ""
open var author: String = ""
}
open class Ingredient : RealmObject() {
@PrimaryKey open var _id: ObjectId = ObjectId()
open var name: String? = ""
open var author: String = ""
}
I’m using createObject. This is the heart of the main function I’m using to create recipes.
realm.executeTransaction { _ ->
try {
val auth = app.currentUser()?.id ?: ""
recipe.title = title
recipe.author = auth
if(directionView) {
recipe.directions.deleteAllFromRealm()
for (i in textBoxContents) {
val dir = realm.createObject<Direction>(ObjectId())
dir.text = i
dir.author = auth
recipe.directions.add(dir)
}
}
else {
recipe.ingredients.deleteAllFromRealm()
for (i in textBoxContents) {
val ing = realm.createObject<Ingredient>(ObjectId())
ing.name = i
ing.author = auth
recipe.ingredients.add(ing)
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
My final experiment last night was to fall back to hard coded strings for the ‘author’ key. That change did restore synch. My next thought is that the problem is in the lag between creating the object and setting the author. Do I need to custom initialize the model to set an author on creation?