diff --git a/src/object-store/src/binding_context.hpp b/src/object-store/src/binding_context.hpp index d57ce541..8290144b 100644 --- a/src/object-store/src/binding_context.hpp +++ b/src/object-store/src/binding_context.hpp @@ -80,7 +80,7 @@ public: struct ObserverState; - // Override this function if you want to recieve detailed information about + // Override this function if you want to receive detailed information about // external changes to a specific set of objects. // This is called before each operation which may advance the read // transaction to include diff --git a/src/object-store/src/object_accessor.hpp b/src/object-store/src/object_accessor.hpp index 5c54ad1d..7c718192 100644 --- a/src/object-store/src/object_accessor.hpp +++ b/src/object-store/src/object_accessor.hpp @@ -322,7 +322,7 @@ namespace realm { if (!try_update && row_index != realm::not_found) { throw DuplicatePrimaryKeyValueException(object_schema.name, *primary_prop, - "Attempting to create an object of type '" + object_schema.name + "' with an exising primary key value."); + "Attempting to create an object of type '" + object_schema.name + "' with an existing primary key value."); } } diff --git a/tests/js/realm-tests.js b/tests/js/realm-tests.js index ec426327..6a9ba6b8 100644 --- a/tests/js/realm-tests.js +++ b/tests/js/realm-tests.js @@ -273,7 +273,7 @@ module.exports = { }, testRealmCreateUpsert: function() { - var realm = new Realm({schema: [schemas.IntPrimary, schemas.AllTypes, schemas.TestObject]}); + var realm = new Realm({schema: [schemas.IntPrimary, schemas.StringPrimary, schemas.AllTypes, schemas.TestObject]}); realm.write(function() { var values = { primaryCol: '0', @@ -360,6 +360,19 @@ module.exports = { realm.create('AllTypesObject', {primaryCol: '1', objectCol: null}, true); TestCase.assertEqual(obj0.objectCol, null); TestCase.assertEqual(obj1.objectCol, null); + + // test with string primaries + var obj =realm.create('StringPrimaryObject', { + primaryCol: '0', + valueCol: 0 + }); + TestCase.assertEqual(obj.valueCol, 0); + + realm.create('StringPrimaryObject', { + primaryCol: '0', + valueCol: 1 + }, true); + TestCase.assertEqual(obj.valueCol, 1); }); },