我正在构建一个web应用程序,将用户的个人资料信息存储到Firestore的文档中。我当前将用户显示的名称存储在Firestore中的一个字段下。最近,我刚刚注意到在用户下面有一个displayName字段,我可以用它来获取 var user = firebase.auth().currentUser;
if (user != null) {
name = user.displayName;
} 我想知道是否有可能使用auth中存储的displayName查询用户?与Firestore查询类似: var query = userRef.where("displayed_name&
我正在尝试查询我的Firestore数据库,看看是否使用了所需的用户名。查询可以工作,但是我需要返回一个值,如果它是空的,或者不返回一个值来查看用户名是否已经存在。我正在尝试使用完成处理程序,但它似乎不起作用:
func checkUserTaken(cleanUsername: String ,completion:@escaping(String) -> (Void)){
let db = Firestore.firestore()
var userTaken: String = ""
let docRef = db.co
这是我想要完成的事情:我正在建立一个网络商店。网上商店有一个反应前端。前端从Firestore获取,并在商店页面上显示集合数组中的所有项。用户在商店页面上选择一个项目。对我的和服务器进行项字段的签出会话。用户转到Stripe结账表单,并在付款完成后被Stripe发送回我的前端。我在服务器上侦听该事件,然后想要更新Firestore中项目的quantity字段。
但是,如何查询此项的Firestore呢?是否有一种方法只使用这个id字段(或name字段)来查询Firestore?有些东西像:
db
.collection('collections')
目前,我使用以下查询来查询我的firestore数据库: def get_db_from_cloud(self):
"""
gets all the info in the db back to the flask app
as a dictonary ready to be cached
"""
docs = self.db.collection(self.collection_name).stream()
docs_dict = {}
for doc in docs:
是否可以在云firestore中查询文档的多个字段中的任何一个字段中的相同值。
Example like this
await firestore()
.collection('chats')
.where('ownerUserId', '==', user.uid)
.where('chatUserId', '==', user.uid)
.orderBy('createdAt', 'desc')
.get()
or to
现在,我基于另一个字符串数组查询Firestore数组。这很好,但我想知道这是否正确,是否有办法优化它,使它更快。
这是我的密码。
var exampleArray = [test]()
func loadData(textArray : [String]){
let db = Firestore.firestore()
for i in 0..<textArray.count{
db.collection("testCollection").whereField("testField", arr
exports.updateRelatedCards = functions.firestore
.document('topic/{newTopic}')
.onWrite((snap, context) => {
const newTopic = snap.data();
// search for the recieved title in a 'relatedCards' subcollection
return firestore
.collection(`card/{anyCard}/related