Check if field exists in CosmosDB JSON with SQL - nodeJS
If you want to know if a field exists you should use the IS_DEFINED("FieldName")If you want to know if the field's value has a value theFieldName != null orFieldName <> null (apparently)
I use variations of this in production:
SELECT c.FieldNameFROM c WHERE IS_DEFINED(c.FieldName)
All you need to do is change your query to
SELECT r.id, r.authToken.instagram,r.userName FROM root r WHERE r.abc != null
or
SELECT r.id, r.authToken.instagram,r.userName FROM root r WHERE r.abc <> null
Both operators work (tested on the Data Explorer)