我正在尝试创建一个未经身份验证的用户图标‘选择最爱’选项,如果单击一个图标(在ListView of Firestore (图书标题)中的标题列表上),它会保存要路由到新收藏页的数据。我无法在Firestore文档中找到关于top如何做到这一点的信息,但我找到了一个youtube教程,它是为一个流行的颤音WordPair应用程序编写的。下面是用来存储他们的WordPair数据的字符串:
final _randomWordPairs = <WordPair>[];
检查是否已经保存了WordPair列表的另一个变量是:
final _savedWordPairs = Set<W
在运行firebase函数时,我正在获取下面的error log,我试图在recentPosts数组字段中获取文档和值。
Error: Unknown error status: Error: Unknown error status: TypeError: elements.get is not a function
at new HttpsError (/srv/node_modules/firebase-functions/lib/providers/https.js:90:19)
at admin.firestore.collectionGroup.where.get.
我试图从Firebase Firestore中检索一个字段,并将其放入自定义对象中。我成功地从代码中上传了自定义对象,没有任何问题,但是当我试图读取和访问Firestore中的对象列表时,我一直收到以下错误:
java.lang.ClassCastException: java.util.HashMap cannot be cast to SelfMadeQuestion
SelfMadeQuestion类如下所示:
class SelfMadeQuestion(
var openQuestion: Boolean = false,
var questionText: Stri
我在从Firestore检索散列映射值时遇到了问题。我在上传这些值时没有问题,但在检索它们时却遇到了困难。
下面是我的构造函数:
public class OrderItems {
private String uid;
private String product;
private int qty;
private int price;
private int totalPrice;
public OrderItems(){
}
public OrderItems(String uid, String product
当我将一个Date对象写到我的Firestore中时,一切都能正常工作,并且我可以在数据库中看到一个以"timestamp“类型存储的日期。如果我试图将一个Date对象传递给一个云函数,我不知道为什么,但当我将它从云函数存储到firestore DB时,它是一个空对象。 firebase.functions().httpsCallable("myFunction")({date: new Date()}) <---- // this doesn't work 因此,我决定在将Date对象发送到云函数之前,在客户端将其转换为firestore时间戳。如
目前,我有一个屏幕,从“项”集合中获取“项”列表。用户应该能够选择多个项目,并在按下按钮时将它们添加到“items”集合中的文档中。我似乎不知道如何编写函数来将这些项的列表写入Movie文档。
下面的代码示例
这是获取项的循环(到目前为止)。
let movie: Movie
@State var selections: [String] = []
@ObservedObject private var viewModel = ItemsViewModel()
@State private var isSelected = false
@State va
我试图从firebase获取数据到我的xcode项目。我仅有的字段是“用户名”、“年龄”和“数字”。我试图将这些值附加到数组userNames、ages和numbers中。但是,我在附加的年龄和数字行中得到了错误Error: Cannot convert value of type 'String' to expected argument type 'Int。它们都被输入为数据库中的Int类型。
我考虑将数据库的值转换为Int类型,因为我认为Xcode将它们作为String类型?我试过了,但我认为我的代码本身是错误的,所以我无法解决它。我会感谢你的帮助!
fu
我正在尝试用一种新的模式更新我的消防站DB。模型被称为“模型”,下面是为更新该模型而编写的代码。
UpdateLogic.dart
var listOfObj = List<dynamic>();
Model model = new Model('ABC', 1, 18);
listOfObj.add(model);
Firestore.instance.collection('xyz').document(id.uid).setData({"newData": FieldValue.arrayUnion(li
当在Firestore中存储自定义类型时,我得到了以下信息:由于非正常异常'FIRInvalidArgumentException‘终止应用程序,原因:’不支持类型:__SwiftValue。
struct Reply: Codable {
var acceptance: Acceptance
var date: Date
enum CodingKeys: String, CodingKey {
case acceptance
case date
}
}
enum Acceptance: String, Codable
我正在尝试将一个快速字典连接到一个firestore映射字段中。正如我在之前的文章中看到的那样,我已经尝试了多种方法,比如FieldValue.arrayUnion,但它不起作用。有什么简单的方法可以做到吗? //users is the collection and watched is the map field in firestore that I want to update with the dictionary {stringA : stringB}
db.collection("users").document(self.userID).updateData(
我正试图从Firestore中获取一个子集合,作为对象列表。
var areaList:ArrayList<AreaModel> = ArrayList<AreaModel>()
val querySnapshot = firestoreDB.collection("/cities/$city/areas").get()
if(!querySnapshot.result!!.isEmpty) {
Result.success(querySnapshot.toObjects(ArrayList<AreaModel>()))
} el
例如,我为我的产品列表提供了动态过滤器列表,从该过滤器列表中向云函数发送https请求。然后尝试设置该请求中的多个条件where子句 多个条件where子句在本地firebase应用程序中有效,但在云函数中不起作用--更新代码-- import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
import { Query } from "@google-cloud/firestore"; // update code
const