Skip to content

writeResult is undefined when trying to replicate example #917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wzard opened this issue Jun 12, 2018 · 5 comments
Closed

writeResult is undefined when trying to replicate example #917

wzard opened this issue Jun 12, 2018 · 5 comments

Comments

@wzard
Copy link

wzard commented Jun 12, 2018

I am using firestore in react.
I am trying to replicate the example documentation.
I am able to set the doc with the value provided but function is returning undefined on being fulfilled.

The below code which is taken from documentation here is returning writeResult is undefined.

I am able to successfully write the doc though.
Can anyone check.

let documentRef = firestore.doc('col/doc');

documentRef.set({foo: 'bar'}).then(writeResult => {
  console.log(`Document written at: ${writeResult.writeTime}`);
});

@google-oss-bot
Copy link
Contributor

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

@google-oss-bot
Copy link
Contributor

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

@wzard
Copy link
Author

wzard commented Jun 13, 2018

In the set method of Document reference here it is written that the promise returns a non-null void.

Then I presume, writeResult is not forwarded after set and the docs I have mentioned in the issue are wrong?

@jshcrowthe
Copy link
Contributor

It seems like there may be something going on here, but we need more information to really diagnose the problem. Can you put together a repro for us to help triage?

@mikelehen
Copy link
Contributor

This is expected. set() returns a Promise. See https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentReference#set

You are perhaps looking at the gcloud server SDK (https://github.com/googleapis/nodejs-firestore) which has a similar but not quite identical API. Sorry for the confusion.

@firebase firebase locked and limited conversation to collaborators Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants