Skip to content

Add firestore-exp/firestore-lite docs #3843

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

Merged
merged 7 commits into from
Sep 28, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

This is a diff against #3792, which copy pastes the existing docs. This PR modifies them for the Lite and firestore-exp SDK.

@changeset-bot
Copy link

changeset-bot bot commented Sep 24, 2020

⚠️ No Changeset found

Latest commit: 84e69c4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/docs to master September 24, 2020 23:20
@schmidt-sebastian schmidt-sebastian changed the base branch from master to mrschmidt/docs September 24, 2020 23:20
@schmidt-sebastian schmidt-sebastian changed the title Mrschmidt/docsupdate Add firestore-exp/firestore-lite docs Sep 24, 2020
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 24, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore/exp

    Type Base (a6af7c2) Head (d63b572) Diff
    main 477 kB 477 kB +4 B (+0.0%)
  • @firebase/firestore/lite

    Type Base (a6af7c2) Head (d63b572) Diff
    main 140 kB 140 kB +6 B (+0.0%)

Test Logs

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG! There are some places where I think we need backticks for literals, or need to un-capitalize generic terms. Also, any place we can use present tense instead of "will," it is preferred.

Thanks!

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a literal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
* promise with the corresponding failure error will be returned.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest "is returned."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest "Otherwise,"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/**
* Called by the Firestore SDK to convert a custom model object of type T
* into a plain Javascript object (suitable for writing directly to the
* Firestore database). Used with {@link setData()}, {@link WriteBatch#set()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need the parens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hoping it looks nice in the final output, but I am not sure. A lot of the old code did this instead:

{@link setDoc setDoc()}

I hope this is the same as {@link setDoc()}.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh -- I meant "(suitable for....). Not a big deal though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, got it. I do kind of prefer to leave the parenthesis as is. Otherwise, we have to add a conjunction of some sort which will make this part harder to parse.

* set(), get(), etc. on the returned DocumentReference instance, the
* provided converter will convert between Firestore data and your custom
* type U.
* Applies a custom data converter to this DocumentReference, allowing you to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal? Here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*
* @param elements The elements to remove from the array.
* @return The FieldValue sentinel for use in a call to `set()` or `update()`.
* @return The FieldValue sentinel for use in a call to `setDoc()` or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal? Here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -29,7 +29,7 @@ export class Bytes {
}

/**
* Creates a new Blob from the given Base64 string, converting it to
* Creates a new Bytes object from the given Base64 string, converting it to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal? Here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param other The `DocumentSnapshot` to compare against.
* @return true if this `DocumentSnapshot` is equal to the provided one.
* @param left A snapshot to compare.
* @param right A snapshot` to compare.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo backtick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* by waiting for data from the server, but it may return cached data or fail
* if you are offline and the server cannot be reached. This behavior can be
* altered via the `GetOptions` parameter.
* Note: getDoc() attempts to provide up-to-date data when possible by waiting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* if you are offline and the server cannot be reached. This behavior can be
* altered via the `GetOptions` parameter.
* Reads the document referred to by this `DocumentReference` from cache.
* Returns an error of the document is not currently cached.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this should be "if"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this so quickly! Feedback addressed.

* by waiting for data from the server, but it may return cached data or fail
* if you are offline and the server cannot be reached. This behavior can be
* altered via the `GetOptions` parameter.
* Note: getDoc() attempts to provide up-to-date data when possible by waiting
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* if you are offline and the server cannot be reached. This behavior can be
* altered via the `GetOptions` parameter.
* Reads the document referred to by this `DocumentReference` from cache.
* Returns an error of the document is not currently cached.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param other The `DocumentSnapshot` to compare against.
* @return true if this `DocumentSnapshot` is equal to the provided one.
* @param left A snapshot to compare.
* @param right A snapshot` to compare.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -29,7 +29,7 @@ export class Bytes {
}

/**
* Creates a new Blob from the given Base64 string, converting it to
* Creates a new Bytes object from the given Base64 string, converting it to
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*
* @param elements The elements to remove from the array.
* @return The FieldValue sentinel for use in a call to `set()` or `update()`.
* @return The FieldValue sentinel for use in a call to `setDoc()` or
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1114,10 +1197,13 @@ export function refEqual<T>(
}

/**
* Returns true if this `Query` is equal to the provided one.
* Returns true if the provided Queries point to the same collection and apply
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

/**
* Called by the Firestore SDK to convert a custom model object of type T
* into a plain Javascript object (suitable for writing directly to the
* Firestore database). Used with {@link setData()}, {@link WriteBatch#set()}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hoping it looks nice in the final output, but I am not sure. A lot of the old code did this instead:

{@link setDoc setDoc()}

I hope this is the same as {@link setDoc()}.

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param updateFunction The function to execute within the transaction context.
* @return If the transaction completed successfully or was explicitly aborted
* @return If the transaction completed successfully or was explicitly aborted
* (the `updateFunction` returned a failed promise), the promise returned by the
* updateFunction is returned here. Else, if the transaction failed, a rejected
* promise with the corresponding failure error will be returned.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/docs to master September 25, 2020 22:01
@schmidt-sebastian schmidt-sebastian requested review from wilhuff and removed request for yuchenshi, zwu52 and zijianjoy September 25, 2020 22:02
@schmidt-sebastian
Copy link
Contributor Author

@wilhuff - Eric looked at this PR when it was a diff against #3792 and says it looks good. I rebased the PR against master and need a rubberstamp from our team.

@@ -173,6 +174,17 @@ export class FirebaseFirestore
}
}

/**
* Initializes a new instance of Cloud Firestore with the provided settings.
* Can only be called before any other methods, including
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems no longer to be a method. Isn't it a function?

This comment applies throughout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice catch. Fixed here and everywhere.

* {@link getFirestore()}. If the custom settings are empty, this method is
* equivalent to calling {@link getFirestore()}.
*
* @param app The {@link FirebaseApp} that the Firestore instance will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about prepositions at the end of sentences? If so: The app with which the Firestore instance will be associated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no preference here. Fixed.

* {@link initializeFirestore()}, {@link getFirestore()} or
* {@link clearIndexedDbPersistence()}.
*
* If this fails, enableIndexedDbPersistence() will reject the promise it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should enableIndexedDbPersistence be in backticks?

Same concern in the other methods of this type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (three times)

* documents.
*
* Must be called while the firestore instance is not started (after the app is
* shutdown or when the app is first initialized). On startup, this method must
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"shutdown" should be two words or should possibly be "terminated" since terminate is the function, not shutdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/**
* Disables network usage for this instance. It can be re-enabled via {@link
* enableNetwork()}. While the network is disabled, any snapshot listeners,
* getDoc() or getDocs() calls will return results from cache, and any write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should getDoc and getDocs be in backticks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -54,19 +63,25 @@ export class GeoPoint {
}

/**
* Returns the latitude of this geo point, a number between -90 and 90.
* The latitude of this GeoPoint instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeoPoint in backticks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* calendar, represented as seconds and fractions of seconds at nanosecond
* resolution in UTC Epoch time.
*
* It is encoded using the Proleptic Gregorian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflow text?

@@ -64,10 +108,24 @@ export class Timestamp {
}
}

/**
* Convert a Timestamp to a JavaScript `Date` object. This conversion causes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should start with "Converts", not "Convert". Timestamp in backticks or make it lowercase like below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

toDate(): Date {
return new Date(this.toMillis());
}

/**
* Convert a timestamp to a numeric timestamp (in milliseconds since epoch).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Converts"

Also, the first "timestamp" should probably be Timestamp since we're talking about both this type and "numeric timestamp" in the same sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* the following values:
*
* <ul>
* <li><code>debug</code> for the most verbose logging level, primarily for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these <code> spans just be backticks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Sep 25, 2020
Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough review! Feedback addressed.

@@ -173,6 +174,17 @@ export class FirebaseFirestore
}
}

/**
* Initializes a new instance of Cloud Firestore with the provided settings.
* Can only be called before any other methods, including
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice catch. Fixed here and everywhere.

* {@link getFirestore()}. If the custom settings are empty, this method is
* equivalent to calling {@link getFirestore()}.
*
* @param app The {@link FirebaseApp} that the Firestore instance will be
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no preference here. Fixed.

* {@link initializeFirestore()}, {@link getFirestore()} or
* {@link clearIndexedDbPersistence()}.
*
* If this fails, enableIndexedDbPersistence() will reject the promise it
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (three times)

* documents.
*
* Must be called while the firestore instance is not started (after the app is
* shutdown or when the app is first initialized). On startup, this method must
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/**
* Disables network usage for this instance. It can be re-enabled via {@link
* enableNetwork()}. While the network is disabled, any snapshot listeners,
* getDoc() or getDocs() calls will return results from cache, and any write
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -23,15 +23,24 @@ import {
import { primitiveComparator } from '../util/misc';

/**
* Immutable class representing a geo point as latitude-longitude pair.
* This class is directly exposed in the public API, including its constructor.
* An immutable object representing a geo point in Firestore. The geo point
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -54,19 +63,25 @@ export class GeoPoint {
}

/**
* Returns the latitude of this geo point, a number between -90 and 90.
* The latitude of this GeoPoint instance.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -64,10 +108,24 @@ export class Timestamp {
}
}

/**
* Convert a Timestamp to a JavaScript `Date` object. This conversion causes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

toDate(): Date {
return new Date(this.toMillis());
}

/**
* Convert a timestamp to a numeric timestamp (in milliseconds since epoch).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* the following values:
*
* <ul>
* <li><code>debug</code> for the most verbose logging level, primarily for
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 28, 2020

Size Analysis Report

Affected Products

No changes between base commit (a6af7c2) and head commit (d63b572).

Test Logs

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* caching or see local modifications, please use the full Firestore SDK.
*
* @param reference The reference of the document to fetch.
* @return A Promise resolved with a DocumentSnapshot containing the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is wrong with the DocumentSnapshot here. Too many spaces surrounding it and no backticks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -903,11 +903,11 @@ export function doc<T>(
* All documents are directly fetched from the server, even if the document was
* previously read or modified. Recent modifications are only reflected in the
* retrieved `DocumentSnapshot` if they have already been applied by the
* backend. If you like to use caching or see local modifications, please use
* the full Firestore SDK.
* backend. If the client is offline, the read fails. If you like to use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space after period.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Sep 28, 2020
@schmidt-sebastian schmidt-sebastian merged commit 7c1c7f1 into master Sep 28, 2020
@firebase firebase locked and limited conversation to collaborators Oct 29, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/docsupdate branch November 9, 2020 22:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants