MCPcopy Create free account
hub / github.com/parse-community/parse-server / findObjects

Function findObjects

src/GraphQL/helpers/objectsQueries.js:87–231  ·  view source on GitHub ↗
(
  className,
  where,
  order,
  skipInput,
  first,
  after,
  last,
  before,
  keys,
  include,
  includeAll,
  readPreference,
  includeReadPreference,
  subqueryReadPreference,
  config,
  auth,
  info,
  selectedFields,
  parseClasses
)

Source from the content-addressed store, hash-verified

85};
86
87const findObjects = async (
88 className,
89 where,
90 order,
91 skipInput,
92 first,
93 after,
94 last,
95 before,
96 keys,
97 include,
98 includeAll,
99 readPreference,
100 includeReadPreference,
101 subqueryReadPreference,
102 config,
103 auth,
104 info,
105 selectedFields,
106 parseClasses
107) => {
108 if (!where) {
109 where = {};
110 }
111 transformQueryInputToParse(where, className, parseClasses);
112 const skipAndLimitCalculation = calculateSkipAndLimit(
113 skipInput,
114 first,
115 after,
116 last,
117 before,
118 config.maxLimit
119 );
120 let { skip } = skipAndLimitCalculation;
121 const { limit, needToPreCount } = skipAndLimitCalculation;
122 let preCount = undefined;
123 if (needToPreCount) {
124 const preCountOptions = {
125 limit: 0,
126 count: true,
127 };
128 if (readPreference) {
129 preCountOptions.readPreference = readPreference;
130 }
131 if (Object.keys(where).length > 0 && subqueryReadPreference) {
132 preCountOptions.subqueryReadPreference = subqueryReadPreference;
133 }
134 preCount = (
135 await rest.find(config, auth, className, where, preCountOptions, info.clientSDK, info.context)
136 ).count;
137 if ((skip || 0) + limit < preCount) {
138 skip = preCount - limit;
139 }
140 }
141
142 const options = {};
143
144 if (selectedFields.find(field => field.startsWith('edges.') || field.startsWith('pageInfo.'))) {

Callers

nothing calls this directly

Calls 4

calculateSkipAndLimitFunction · 0.85
needToGetAllKeysFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…