“contactDetails”: {
“EMAIL”: {
“channel”: “EMAIL”,
“value”: “mandeep.singh@aceindia.com ”
},
“MOBILE”: {
“channel”: “MOBILE”
},
“PHONE”: {
“channel”: “PHONE”,
“countryCode”: “95”,
“value”: “12312312”
}
},
i want to factch data on base of where countrycode=95
Hello,
you can select a child node, a rapid sample:
select * from bucketname where contactDetails.PHONE.countryCode=95
Good luck
it’s not working, showing error filed not found.
vsr1
January 8, 2020, 1:15pm
4
INSERT INTO default VALUES ("k01", {"contactDetails": { "EMAIL": { "channel": "EMAIL", "value": "mandeep.singh@aceindia.com" }, "MOBILE": { "channel": "MOBILE" }, "PHONE": { "channel": "PHONE", "countryCode": "95", "value": "12312312" } }});
SELECT * FROM default WHERE contactDetails.PHONE.countryCode = "95";
countryCode is string. Use string search not integer. i.e 95 is not same as “95”
All the field names are case sensitive. Use exact same case in the document.
select * from bucketname where contactDetails.PHONE.countryCode="95"
Your country code is string so you must quote this element
select contactDetails from data where contactDetails is not missing limit 1;
[
{
“contactDetails”: {
“EMAIL”: {
“channel”: “EMAIL”,
“value”: “mandeep.singh@accoliteindia.com ”
},
“MOBILE”: {
“channel”: “MOBILE”
},
“PHONE”: {
“channel”: “PHONE”,
“countryCode”: “95”,
“value”: “12312312”
}
}
}
]
vsr1
January 8, 2020, 1:30pm
8
The data model of object is different from your original post. This document does not have fields
contactDetails.PHONE
contactDetails.PHONE.countryCode
Can you post document image also
select contactDetails from data where contactDetails is not missing limit 1;
[
{
“contactDetails”: {
“EMAIL”: {
“channel”: “EMAIL”,
“value”: “mandeep.singh@accoliteindia.com ”
},
“MOBILE”: {
“channel”: “MOBILE”
},
“PHONE”: {
“channel”: “PHONE”,
“countryCode”: “95”,
“value”: “12312312”
}
}
}
]
vsr1
January 8, 2020, 1:38pm
10
The query should have given data.
May be you can post EXPLAIN plan or after execution output from Plan Text Tab and index definition