我想从firestore的集合中获取数据(语言字段),并带有where子句,但是它不起作用。
我的代码:
db = FirebaseFirestore.getInstance();
Query query = db.collection(collection).whereGreaterThan("longtitude", String.valueOf(bounds.northeast.latitude));
query.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@javax.annotation.Nullable QuerySnapshot queryDocumentSnapshots, @javax.annotation.Nullable FirebaseFirestoreException e) {
if (e != null) {
Log.w(TAG, "Listen failed.", e);
return;
}
if (queryDocumentSnapshots != null) {
Log.d(TAG, queryDocumentSnapshots.getMetadata().toString());
} else {
Log.d(TAG, "Current data: null");
}
}
});
我只能得到
SnapshotMetadata{hasPendingWrites=false, isFromCache=false}
但是我要从集合中获取字段。怎么做?
我尝试了不同的方法,但没有一个方法返回集合中的字段。
答案 0 :(得分:0)
对集合运行查询时,会得到一个function detectProxy() {
$sockport = false;
$proxyports=array(80,8080,6588,8000,3128,3127,3124,1080,553,554);
for ($i = 0; $i <= count($proxyports); $i++) {
if(@fsockopen($ipaddress,$proxyports[$i],$errstr,$errno,0.5)){
$sockport=true;
}
}
if(
isset($_SERVER['HTTP_VIA'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| isset($_SERVER['HTTP_FORWARDED_FOR'])
|| isset($_SERVER['HTTP_X_FORWARDED'])
|| isset($_SERVER['HTTP_FORWARDED'])
|| isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_FORWARDED_FOR_IP'])
|| isset($_SERVER['VIA'])
|| isset($_SERVER['X_FORWARDED_FOR'])
|| isset($_SERVER['FORWARDED_FOR'])
|| isset($_SERVER['X_FORWARDED'])
|| isset($_SERVER['FORWARDED'])
|| isset($_SERVER['CLIENT_IP'])
|| isset($_SERVER['FORWARDED_FOR_IP'])
|| isset($_SERVER['HTTP_PROXY_CONNECTION'])
|| $sockport === true
) {
echo 'User is using proxy';
}
else{
echo ''user is not using proxy';
}
}
,其中可以包含零个或多个文档。要获取实际的文档,您需要像here所示那样遍历文档:
QuerySnapshot