I am trying to add a third level of data but I am not being able to add it and then retrieve the data using the identifier.
Here is the structure of the data:
db.rooms.find({"_id" : "1620888265"}).pretty(); { "_id" : "1620888265", "start" : 1620988265, "end" : null, "users" : [ { "name" : "eric casanova", "ip" : "127.0.0.1", "uid" : "ShasmANxKLgP6aI5.q38SlhdsHrauxDin2tu-JtpRqnR2iRm", "score" : 0.9, "singin" : 1620895469 }, { "name" : "eric casanova", "ip" : "127.0.0.1", "uid" : "ShasmANxKLgP6aI5.q38SlhdsHrauxDin2tu-JtpRqnR2iRm", "score" : null, "singin" : 1620895469 } ], "questions" : [ 1, ] }
This is what I would like to achieve:
{ "_id" : "1620888265hby", ... "questions" : [ 1: { "title" : "X", "released" : true } ] }
or
{ "_id" : "1620888265", ... "questions" : [ { "id": 1 "title" : "X", "released" : true } ] }
The "1" would be the identifier of that object
I’ve tried so many things that I don’t even know what to use as a command example. I leave you the last thing I have on the console:
rooms_db->find(['_id' =>
cursor as
row) { if (isset(
counter += count(
question = [ 'ident'=>
_POST['title'], 'released' => false ];
nameRoom), array('
question)), array("upsert" => true));
Any help and ideas are welcome!
Anonymous Asked question May 13, 2021
Recent Comments