google-cloud-firestore

How to write a function that accepts user email and password from client and registers him? (Firestore functions)

自作多情 提交于 2020-04-18 05:49:25
问题 I have this case where I want to register users with email and password, so I want to write a function which accepts those two parameters and creates a new user and returns a message OK or something. This is my code in React-Native: firebase.functions().httpsCallable('registerNewPatient')({ email: 'testestbmf@hotmail.com', password: 'bbbbbb1' }).then((onfulfilled, onrejected) => { if (onfulfilled) { console.log("OK callback function:", onfulfilled); } else { console.log("Error callback

How to write a function that accepts user email and password from client and registers him? (Firestore functions)

可紊 提交于 2020-04-18 05:49:23
问题 I have this case where I want to register users with email and password, so I want to write a function which accepts those two parameters and creates a new user and returns a message OK or something. This is my code in React-Native: firebase.functions().httpsCallable('registerNewPatient')({ email: 'testestbmf@hotmail.com', password: 'bbbbbb1' }).then((onfulfilled, onrejected) => { if (onfulfilled) { console.log("OK callback function:", onfulfilled); } else { console.log("Error callback

Why is State always empty?

蓝咒 提交于 2020-04-18 05:48:36
问题 I have thoroughly gone through all the asked question and none of them apply to my problem directly. I am looping through an array of user ids and matching them to get a user from my firestore db. I get the result back with no problem but when i store it in the state array and run a console log, my state array is always empty. The first console.log works and shows the results from the db. Here's my code: const UsersScreen = (props) => { const [state, setState] = useState({ users: [] }); const

Firebase Cloud Function Transaction write on firestore throws await as an error

感情迁移 提交于 2020-04-18 05:47:48
问题 When I try to carry out a transaction on firestore, it throws me an error Unexpected token admin on the below code exports.issueBook = functions.https.onCall(async(data, context) => { if (!(context.auth && context.auth.token.admin)) { throw new functions.https.HttpsError( 'unauthenticated', 'only authenticated Admins can Issue Books' ); } memberData = { name: data.issueData.memberName, no: data.issueData.memberNo, role: data.issueData.memberRole, } transactionData = { books: data.issueData

Firestore document does NOT have 1 MiB (1,048,576 bytes) [duplicate]

主宰稳场 提交于 2020-04-18 05:46:49
问题 This question already has an answer here : What is the exact size of a Firestore document? (1 answer) Closed 6 days ago . Problem: I'm building an app where I want to display a list of 50k locations. Knowing that the size of geographical point is 16 bytes, I decided to store all of them in a single document. The location where I store this list is: db.collection("points").document("geo"); I know that the size of a document is composed of three components: document name size The sum of the

How to build a Firestore query chain based on a dynamic response from a promise

瘦欲@ 提交于 2020-04-18 05:42:26
问题 Let's say I need to query Firestore against a collection of subjects that I receive in a promise: const subjects: string[] = await getSubjects(); //response: ['Math', 'Science', 'History']; Since I don't know how many subjects might be returned in the promise at any given time, how would I go about dynamically generating the chain below so I can properly query Firestore? ref.where('subject[subjects[0].toLowerCase()]', '==' , true) .where('subject[subjects[1].toLowerCase()]', '==' , true)

Angular Firestore combineLatest with multiple queries

故事扮演 提交于 2020-04-18 03:57:39
问题 I'm having a little trouble with Angular9, Firestore6 and the combineLatest rxjs operator. I have one collection of users , and another collection of items . One user can have several items, but in an old fashioned manyToMany relationship way, in which the items are master data (non modifiable) and the bridge table joins both collections with additional data: items apple name: "apple" color: "green" user items uid uid: "apple" quantity: 23 So I need to get a list of the items of the logged in

Firestore double field query request (and with GeoPoint)

谁说我不能喝 提交于 2020-04-18 03:54:47
问题 I have got a collection of documents with two fields: a location (Geopoint) and a distance (Number). The user input is another location (Geopoint). I've to return all the documents where the distance between the location of the document and the location of the input is less than the distance of the document. This tutorial shows how to perform nearby location queries but how can I insert in the equation the distance if it is not given by the user but different for each document? 回答1: I came up

How To Populate A Gridview With Images Retreieved From Firebase Storage

大城市里の小女人 提交于 2020-04-18 03:45:14
问题 I have reviewed other similar posts before posting this, mine is different I am current retrieving a list of download urls from my Firestore data base, then trying to download those images from my firebase storage to display them in a gridview. This is my code so far: final Query chatRoomMsgs = db.collection("chatrooms").document(chatRoomID).collection("Messages").whereEqualTo("sentby", firebaseAuth.getUid()); chatRoomMsgs.get() .addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {

Error in deleting specific field in a cloud firestore document

对着背影说爱祢 提交于 2020-04-17 22:52:03
问题 I'm using this code from here Firestore.instance.collection('path').document('name').updateData({'Desc': FieldValue.delete()}).whenComplete((){ print('Field Deleted'); }); I'm using cloud_firestore: 0.13.2+1 However, this throws an error [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'MethodChannelFieldValue' is not a subtype of type 'FieldValuePlatform' Can anyone tell me how to delete a field right way 回答1: You may refer to the official Firestore documentation for