Hey guys, I got 2 questions, but first:
The error shown in console and logs:
{
"code": 121,
"level": "error",
"message": "Nested keys should not contain the '$' or '.' characters",
"stack": "Error: Nested keys should not contain the '$' or '.' characters\n at C:\\Users\\User1\\Documents\\GitHub\\testing-parse-server\\node_modules\\parse-server\\lib\\Controllers\\DatabaseController.js:522:21\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
"timestamp": "2022-09-13T18:00:00.162Z"
}
The code used:
/* Some context:
*
* ipsArray = { '::ffff:127.0.0.1': { loginCounter: 0, logoutCounter: 1 } }
* So I can't use the key "::ffff:127.0.0.1" because it contains the "." char
*/
userRow.set("ip", ipsArray);
try {
await userRow.save(null, { useMasterKey: true });
} catch(error) {
throw "Something went wrong on logout. (Code 0)";
}
So the problem is that I can’t have an object key with the “$” or “.” character.
I suppose I can replace every “.” and “$” for another char.
-
But why can’t we use this chars in object keys? I can set it manually in my database so it’s not a problem with MongoDB. Is this a limitation of Parse?
-
Now the weird one, using “throw” inside that catch crashes the server, why? I usually use “throw” without any problems and it just returns the message to the client without crashing the server.
Thanks In Advance!