[firestore docs] Question about query name in firestore snippets
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- documentation
Research direction
Inspect firestore/main/index.js around simpleQuery and queryAndFilter, then compare the linked Firestore query documentation. Determine the naming convention intended for collection references, query objects, and query results; the work is done when the snippet and linked documentation use consistent, agreed naming.
Written by the indexing model from the issue text.
Description
in simpleQuery function, reference to a collection is named citiesRef (1) and query on this ref is named queryRef (2) - both with ref at the end. Only the result of the query is named res (3)
async function simpleQuery(db) {
// Create a reference to the cities collection
const citiesRef = db.collection('cities'); // (1)
// Create a query against the collection
const queryRef = citiesRef.where('state', '==', 'CA'); // (2)
// [END firestore_query_filter_eq_string]
const res = await queryRef.get(); // (3)
res.forEach(doc => {
console.log(doc.id, ' => ', doc.data());
});
}
however in queryAndFilter function we have a query on a ref that ends with a res in the variable name (1). Shouldn't it be called allCapitalsRef? What is the proper naming convention?
async function queryAndFilter(db) {
// Create a reference to the cities collection
const citiesRef = db.collection('cities');
// Create a query against the collection
const allCapitalsRes = citiesRef.where('capital', '==', true); // (1)
// ...rest of the function
}
The code is provided at https://firebase.google.com/docs/firestore/query-data/queries#simple_queries
- Dominant language
- JavaScript
- Stars
- 395
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/snippets-node
-
Holis Open
Difficulty 1/5 Under an hour Newbie friendliness 1/100
firebase/snippets-node#420 ·
-
My phone Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
firebase/snippets-node#402 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
firebase/snippets-node#375 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/snippets-node#335 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
firebase/snippets-node#289 ·
All issues in firebase/snippets-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·