hi i would like to execute n1ql query within nested array but the result returned by the query is always empty despite the fact that there is some elements satisfaying the condition.
consider the json:
{
“parcours”: [
{
“dateArrete”: null,
“dateFinService”: null,
“datePriseService”: “15-6-2018”,
“fonction”: “CHEF DES TRAVAUX”,
“numeroArrete”: null,
“posteActuel”: true,
“structure”: “”,
“structureId”: -1,
“typeStructure”: null
},
{
“dateArrete”: null,
“dateFinService”: “”,
“datePriseService”: “”,
“fonction”: “”,
“numeroArrete”: null,
“posteActuel”: false,
“structure”: “”,
“structureId”: -1,
“typeStructure”: null
}
],
“personnel”: {
“LangueEnseignement”: “Francais”,
“address”: null,
“arrondissementOrigine”: “”,
“arrondissementOrigineConjoint”: “”,
“birthDate”: “15-5-2018”,
“dateIntegration”: “15-6-2018”,
“departementOrigine”: “NYONG ET KELLE”,
“departementOrigineConjoint”: “”,
“email”: null,
“etatSante”: null,
“firstName”: “duvduv”,
“fonctionConjoint”: “”,
“grade”: “PCEG”,
“indice”: null,
“langueEnseignement”: “Francais”,
“lastName”: null,
“matricule”: “d-012768”,
“nbEnfant”: 5,
“nbEnfantScolarise”: 0,
“nomConjoint”: “”,
“phoneNumber”: 679494639,
“picturePath”: null,
“placeBirth”: “bertoua”,
“regionOrigine”: “LT”,
“regionOrigineConjoint”: “”,
“secondPhoneNumber”: -1,
“sexe”: “M”,
“situationMatrimoniale”: “DIVORCE(E)”,
“specialite”: “DROIT”
},
“type”: “personnel”
}
I wrote the following android query:
VariableExpression varParcoursItem = ArrayExpression.variable(“parcoursItem”);
VariableExpression varParcoursItemStructureId = ArrayExpression.variable(“parcoursItem.structureId”);
Database database = DatabaseManager.getDatabase();
Query query = QueryBuilder
.select(SelectResult.all())
.from(DataSource.database(database))
.where(Expression.property(“type”).equalTo(Expression.string(“personnel”)
.and(ArrayExpression.any(varParcoursItem).in(Expression.property(“parcours”))
.satisfies(varParcoursItemStructureId.equalTo(Expression.intValue(-1))))));
but the result returned is empty despite the fact that the previous json satifies condition. Please where is the mistake