Yesterday the data or content of my first client website collapsed. That is to say, the front-end still accessed the data but in Cockpit Admin, all I had for Collections was a nice animated GIF and console.log told me a Promise was not returned (Precondition not fulfilled). I had access to singleton but not to collections.
Copying the files from a backup did not solve the problem - I have my suspicions as to what has happened which I am sure Artur will confirm.
The moral of the story is that I am not going to install a server version of MongoDB not can I use a cloud version. I always manage things myself on my own dedicated servers.
So I have looked into JSON on MySQL/MariaDB and see absolutely no problem to replicate the Cockpit data dictionary onto MySQL.
INSERT INTO dbitem (qtype, qdocument, qnotes)
VALUES (
'string',
JSON_OBJECT (
"qreference", "str(0)",
"qcommon", "Login",
"qtext", JSON_ARRAY(
'{"en":"Login"}',
'{"es":"Acceder"}'
)
),
'Additional notes');
SELECT id, qtype, JSON_EXTRACT(qdocument, '$.qtext') AS qtext, qdocument, qnotes FROM dbitem;
qtext = array
SELECT id, qtype, JSON_EXTRACT(qdocument, '$.qtext.en') AS qtext, qdocument, qnotes FROM dbitem;
qtext = null
SELECT id, qtype, JSON_EXTRACT(qdocument, '$.qtext[en]') AS qtext, qdocument, qnotes FROM dbitem;
qtext = null
SELECT id, qtype, JSON_EXTRACT(qdocument, '$.qtext["en"]') AS qtext, qdocument, qnotes FROM dbitem;
qtext = null
SELECT id, qtype, JSON_EXTRACT(qdocument, '$.qtext[0]["en"]') AS qtext, qdocument, qnotes FROM dbitem;
qtext = null
SELECT id, qtype,
JSON_EXTRACT(qdocument, '$.qreference') AS qreference,
JSON_EXTRACT(qdocument, '$.qcommon') AS qcommon,
JSON_EXTRACT(qdocument, '$.qtext') AS qtext,
qnotes
FROM dbitem;
SELECT id, qtype,
JSON_EXTRACT(qdocument, '$.qreference') AS qreference,
JSON_EXTRACT(qdocument, '$.qcommon') AS qcommon,
JSON_EXTRACT(qdocument, '$.qtext') AS qtext,
qnotes
FROM dbitem;
works
SELECT id, qtype,
qdocument => '$.qreference' AS qreference,
qdocument => '$.qcommon' AS qcommon,
qdocument => '$.qtext' AS qtext,
qnotes
FROM dbitem;
error - not supported in MariaDB, only MySQL
SELECT id, qtype,
JSON_EXTRACT(qdocument, '$.qreference') AS qreference,
JSON_EXTRACT(qdocument, '$.qcommon') AS qcommon,
JSON_EXTRACT(qdocument, '$["$.qtext"]["$.en"]') AS qtext,
qnotes
FROM dbitem;
error - no variety of this works
-------------
Do we keep qtext as an array or create separate individual versions?
qtext: ['en':'Login', 'es':'Acceder]
or
qtext_en = 'Login'
qtext_es = 'Acceder'
I am using my own datadictionary nomenclature but you can see the point.
JSON on MariaDB or MySQL has limitations regarding accessing embedded arrays but so has MongoDBLite, so as to speak, and the problem about the best way to handle multiple languages still applies. However I can see my own way forward but I thought I would share my findings with you all.