Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Flatter-Cloud函数Firestore查询在使用数组时返回0个结果,但在使用字符串时返回一些结果_Node.js_Flutter_Dart_Google Cloud Firestore_Google Cloud Functions - Fatal编程技术网

Node.js Flatter-Cloud函数Firestore查询在使用数组时返回0个结果,但在使用字符串时返回一些结果

Node.js Flatter-Cloud函数Firestore查询在使用数组时返回0个结果,但在使用字符串时返回一些结果,node.js,flutter,dart,google-cloud-firestore,google-cloud-functions,Node.js,Flutter,Dart,Google Cloud Firestore,Google Cloud Functions,我正在尝试运行firestore查询以查找已选择某些作业的用户 const selected = data.selected; const query = db .collection(“user-info”) .where(“isEngaged”, “==“, false) .where(“selectedJobs”, “array-contains”, selected); return query.get().th

我正在尝试运行firestore查询以查找已选择某些作业的用户

    const selected = data.selected;

    const query = db
        .collection(“user-info”)
        .where(“isEngaged”, “==“, false)
        .where(“selectedJobs”, “array-contains”, selected);

    return query.get().then((querySnpashot) => {
      if (querySnapshot > 0) {
         return "There are some users";
      } else {
        return "There are no users";
      }
    });
当我将数据作为字符串从flatter传递到函数时

var selected = 'Gardening'

final HttpsCallableResult result = await function.call(<String, dynamic>{
  'selected' : selected
});

print(result.data);
var selected='gardenting'
最终HttpScalableResult结果=wait function.call({
“已选定”:已选定
});
打印(结果、数据);
控制台打印出“有一些用户”

但当我将所选字段设置为列表时

var selected = List<String>['Gardening', 'Laundry'];

final HttpsCallableResult result = await function.call(<String, dynamic>{
  'selected' : selected
});

print(result.data);
var selected=列表[‘园艺’、‘洗衣房’];
最终HttpScalableResult结果=wait function.call({
“已选定”:已选定
});
打印(结果、数据);
控制台打印出“没有用户”

有没有一种方法可以使用列表而不是字符串进行查询