parse-community / parse-community/parse-server

fetchWithSelected, fetchWithExcluded

Open
#7,367 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
Current Limitation

Parse.Query has a include, exclude for selecting only some columns.
But there is no feature like that for fetch method

Feature / Enhancement Description

fetchWithSelect, fetchWithExclude can be useful methods for specific column only.

Example Use Case
fetchWithSelected(['name', 'score'], {useMasterKey: true}) 
fetchWithExcluded(['name', 'score'], {useMasterKey: true}) 
const getPartnerInfo = async (userId: string) => {
  const user = new Parse.User()
  user.id = userId
  await user.fetchWithExcluded(['sensitiveData', 'phoneNumber'], {useMasterKey: true}) 

  return user
}
Alternatives / Workarounds

Fetch with query:

const getPartnerInfo = async (userId: string) => {
  const query = new Parse.Query(Parse.User)
  query.equalTo('objectId', userId)
  query.exclude(['sensitiveData', 'phoneNumber'])
  return query.first({useMasterKey: true})
}
3rd Party References

(none)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Parse.Query fetch, select, and exclude entry points to understand how field selection currently works. Define the behavior of fetchWithSelected and fetchWithExcluded, including their option handling, and verify that fetching an object returns only the requested fields or omits the excluded fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.