I'm doing a flask application. I need to get the elements of the session that are inside an array in mongodb.
I tried to do everything, but I was unsuccessful.
I need to get the 'password' inside 'contatos'.
To do a validation within my application.
I know that if you do the following code: print(session['company'].Get("contatos"))
, it shows all the content of the object, but I can't access the elements inside that object.
{
"nome": "Empresa Teste",
"cnpj": "00.000.000/0001-00",
"endereco": {
"endereco": "Rua, 1",
"cidade": "Cidade Teste",
"estado": "Estado Teste",
"uf": "AA"
},
"idMatriz": 1,
"dtCadastro": "01/01/2020",
"plano": {
"id": 1,
"nome": "Plano de Teste",
"validade": "01/01/2020"
},
"contatos": [{
"nome": "Fabio",
"email": "Teste",
"password": "pass",
"telefone": "Teste"
}],
"contasCadastradas ": [{
"concessionaria": {
"id": 1,
"nome": "EnelSP"
},
"identificador": "Numero da Instalacao",
"cronogramaBusca": {
"inicio": 1,
"vencimento": 1,
"fim": 1
},
"metodosCaptura": [{
"tipoCaptura": "site",
"ordem": 1,
"usuario": "user",
"senha": "pwd",
"destino": "endereco do site"
}, {
"tipoCaptura": "email",
"ordem": 2,
"usuario": "user",
"senha": "pwd",
"destino": ""
}]
}, {
"concessionaria": {
"id": 2,
"nome": "TIM"
},
"identificador": "Numero da Instalacao",
"cronogramaBusca": {
"inicio": 1,
"vencimento": 1,
"fim": 1
},
"metodosCaptura ": [{
"tipoCaptura": "site",
"ordem": 1,
"usuario": "user",
"senha": "pwd",
"destino": "endereco do site"
}, {
"tipoCaptura": "email",
"ordem": 2,
"usuario": "user",
"senha": "pwd",
"destino": ""
}]
}]
}
can you help me?
question from:
https://stackoverflow.com/questions/66050526/how-to-get-elements-in-array-flask