diff --git a/packages/accounts-password/password_server.js b/packages/accounts-password/password_server.js index 93af180f05..689cf75f27 100644 --- a/packages/accounts-password/password_server.js +++ b/packages/accounts-password/password_server.js @@ -80,7 +80,7 @@ const handleError = (msg, throwError = true) => { const error = new Meteor.Error( 403, Accounts._options.ambiguousErrorMessages - ? "Login failure. Please check your login credentials." + ? "Something went wrong. Please check your credentials." : msg ); if (throwError) { diff --git a/packages/minimongo/common.js b/packages/minimongo/common.js index 7aa0cafc27..a0260feebb 100644 --- a/packages/minimongo/common.js +++ b/packages/minimongo/common.js @@ -777,8 +777,8 @@ function getValueBitmask(value, length) { function insertIntoDocument(document, key, value) { Object.keys(document).forEach(existingKey => { if ( - (existingKey.length > key.length && existingKey.indexOf(key) === 0) || - (key.length > existingKey.length && key.indexOf(existingKey) === 0) + (existingKey.length > key.length && existingKey.indexOf(`${key}.`) === 0) || + (key.length > existingKey.length && key.indexOf(`${existingKey}.`) === 0) ) { throw new Error( `cannot infer query fields to set, both paths '${existingKey}' and ` + diff --git a/packages/minimongo/minimongo_tests_client.js b/packages/minimongo/minimongo_tests_client.js index 776af9aeac..03b2b9dc78 100644 --- a/packages/minimongo/minimongo_tests_client.js +++ b/packages/minimongo/minimongo_tests_client.js @@ -3006,7 +3006,10 @@ Tinytest.add('minimongo - modify', test => { upsert({"_id": "foo", "foo": "bar"}, {"bar": "foo"}, {"_id": "foo", "bar": "foo"}) // Replacement update keeps _id upsertUpdate({"_id": "foo", "bar": "baz"}, {"_id":"foo"}, {"bar": "crow"}, {"_id": "foo", "bar": "crow"}); - + // Test for https://github.com/meteor/meteor/issues/9167 + upsert({key: 123, keyName: '321'}, {$set: {name: 'Todo'}}, {key: 123, keyName: '321', name: 'Todo'}); + upsertException({key: 123, "key.name": '321'}, {$set:{}}); + // Nested fields don't work with literal objects upsertException({"a": {}, "a.b": "foo"}, {}); // You can't have an ambiguious ID