From b45c1498dd55b81917ec7f9e7dc6c139f616e671 Mon Sep 17 00:00:00 2001 From: "Raschid J.F. Rafaelly" Date: Thu, 25 Jul 2019 00:48:34 -0500 Subject: [PATCH 1/4] Add `keys` and `excludeKeys` options to REST docs --- _includes/rest/objects.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md index ba613d753..dd71a42d4 100644 --- a/_includes/rest/objects.md +++ b/_includes/rest/objects.md @@ -140,7 +140,7 @@ The response body is a JSON object containing all the user-provided fields, plus } ``` -When retrieving objects that have pointers to children, you can fetch child objects by using the `include` option. For instance, to fetch the object pointed to by the "game" key: +When retrieving objects that have pointers to children, **you can fetch child objects** by using the `include` option. For instance, to fetch the object pointed to by the "game" key:

@@ -165,6 +165,31 @@ print result
 
+You may **retrieve an object's fields selectively** by using the options `keys` and `excludeKeys`. For example, you could use `keys` to retrieve only the player's name and their score, or you may use `excludeKeys` to fetch everything except their name. Please note that keys shloud be separated by commas with no blank spaces: + +
+

+curl -X GET \
+  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
+  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
+  -G \
+  --data-urlencode 'keys=playerName,score' \
+  https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
+
+

+import json,httplib,urllib
+connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+params = urllib.urlencode({"keys":"playerName,score"})
+connection.connect()
+connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
+       "X-Parse-Application-Id": "${APPLICATION_ID}",
+       "X-Parse-REST-API-Key": "${REST_API_KEY}"
+     })
+result = json.loads(connection.getresponse().read())
+print result
+
+
+ When using a MongoDB replica set, you can use the `readPreference` option to choose from which replica the object will be retrieved. You can also use the `includeReadPreference` option to choose from which replica the included pointers will be retrieved. The possible values for both options are `PRIMARY` (default), `PRIMARY_PREFERRED`, `SECONDARY`, `SECONDARY_PREFERRED`, or `NEAREST`. If the `includeReadPreference` option is not set, the same replica chosen for `readPreference` will be also used for the includes.
@@ -192,6 +217,8 @@ print result
+ + ## Updating Objects To change the data on an object that already exists, send a PUT request to the object URL. Any keys you don't specify will remain unchanged, so you can update just a subset of the object's data. For example, if we wanted to change the score field of our object: From 094451fc755a8f129724740adcd35943e8439125 Mon Sep 17 00:00:00 2001 From: "Raschid J.F. Rafaelly" Date: Fri, 26 Jul 2019 16:14:15 -0500 Subject: [PATCH 2/4] Add `.exclude()` example to JS Guide Added example of Query.exclude() in `js/queries.md` Closes #632 --- _includes/js/queries.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/_includes/js/queries.md b/_includes/js/queries.md index 1ddbf73f0..afc29383c 100644 --- a/_includes/js/queries.md +++ b/_includes/js/queries.md @@ -57,7 +57,7 @@ You can skip the first results by setting `skip`. In the old Parse hosted backen query.skip(10); // skip the first 10 results ``` -If you want to know the total number of rows in a table satisfying your query, for e.g. pagination purposes - you can use `withCount`. +If you want to know the total number of rows in a table satisfying your query, for e.g. pagination purposes - you can use `withCount`. **Note:** Enabling this flag will change the structure of response, see the example below. @@ -176,6 +176,18 @@ query.find().then(function(results) { }); ``` +Similarly, use `exclude` to remove undesired fields while retrieving the rest: + +```javascript +var GameScore = Parse.Object.extend("GameScore"); +var query = new Parse.Query(GameScore); +query.exclude("playerName"); +query.find().then(function(results) { + // Now each result will have all fields except `playerName` +}); +``` + + The remaining fields can be fetched later by calling `fetch` on the returned objects: ```javascript From 9045924ad88eaed98d91565be65fd729b0eec7e3 Mon Sep 17 00:00:00 2001 From: "Raschid J.F. Rafaelly" Date: Sat, 27 Jul 2019 21:12:13 -0500 Subject: [PATCH 3/4] Moved `keys` and `excludeKeys` from objects.md to queries.md Also: * Added `excludKeys` to the parameter table * Added padding to elements in `_normalize.scss` --- _includes/rest/objects.md | 25 ------------------ _includes/rest/queries.md | 42 +++++++++++++++++++++++++------ css/lib/multisite/_normalize.scss | 15 +++++++---- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/_includes/rest/objects.md b/_includes/rest/objects.md index dd71a42d4..737d02344 100644 --- a/_includes/rest/objects.md +++ b/_includes/rest/objects.md @@ -165,31 +165,6 @@ print result -You may **retrieve an object's fields selectively** by using the options `keys` and `excludeKeys`. For example, you could use `keys` to retrieve only the player's name and their score, or you may use `excludeKeys` to fetch everything except their name. Please note that keys shloud be separated by commas with no blank spaces: - -
-

-curl -X GET \
-  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-  -G \
-  --data-urlencode 'keys=playerName,score' \
-  https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
-
-

-import json,httplib,urllib
-connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
-params = urllib.urlencode({"keys":"playerName,score"})
-connection.connect()
-connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
-       "X-Parse-Application-Id": "${APPLICATION_ID}",
-       "X-Parse-REST-API-Key": "${REST_API_KEY}"
-     })
-result = json.loads(connection.getresponse().read())
-print result
-
-
- When using a MongoDB replica set, you can use the `readPreference` option to choose from which replica the object will be retrieved. You can also use the `includeReadPreference` option to choose from which replica the included pointers will be retrieved. The possible values for both options are `PRIMARY` (default), `PRIMARY_PREFERRED`, `SECONDARY`, `SECONDARY_PREFERRED`, or `NEAREST`. If the `includeReadPreference` option is not set, the same replica chosen for `readPreference` will be also used for the includes.
diff --git a/_includes/rest/queries.md b/_includes/rest/queries.md index 912444c8a..47c957c9d 100644 --- a/_includes/rest/queries.md +++ b/_includes/rest/queries.md @@ -302,13 +302,14 @@ print result In addition to `where`, there are several parameters you can use to configure what types of results are returned by the query. -| Parameter | Use | -|-----------------------------------------------------------------| -| order | Specify a field to sort by | -| limit | Limit the number of objects returned by the query | -| skip | Use with limit to paginate through results | -| keys | Restrict the fields returned by the query | -| include | Use on Pointer columns to return the full object | +| Parameter | Use | +|-------------------------------------------------------------------| +| order | Specify a field to sort by | +| limit | Limit the number of objects returned by the query | +| skip | Use with limit to paginate through results | +| keys | Restrict the fields returned by the query | +| excludeKeys | Exlcude specific fields from the returned query | +| include | Use on Pointer columns to return the full object | You can use the `order` parameter to specify a field to sort by. Prefixing with a negative sign reverses the order. Thus, to retrieve scores in ascending order: @@ -411,7 +412,7 @@ print result
-You can restrict the fields returned by passing `keys` a comma-separated list. To retrieve documents that contain only the `score` and `playerName` fields (and also special built-in fields such as `objectId`, `createdAt`, and `updatedAt`): +You can restrict the fields returned by passing `keys` or `excludeKeys` a comma-separated list. To retrieve documents that contain only the `score` and `playerName` fields (and also special built-in fields such as `objectId`, `createdAt`, and `updatedAt`):

@@ -436,6 +437,31 @@ print result
 
+Or you may use `excludeKeys` to fetch everything except `playerName`: + +
+

+curl -X GET \
+  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
+  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
+  -G \
+  --data-urlencode 'excludeKeys=playerName' \
+  https://YOUR.PARSE-SERVER.HERE/parse/classes/GameScore/Ed1nuqPvcm
+
+

+import json,httplib,urllib
+connection = httplib.HTTPSConnection('YOUR.PARSE-SERVER.HERE', 443)
+params = urllib.urlencode({"excludeKeys":"playerName"})
+connection.connect()
+connection.request('GET', '/parse/classes/GameScore/Ed1nuqPvcm?%s' % params, '', {
+       "X-Parse-Application-Id": "${APPLICATION_ID}",
+       "X-Parse-REST-API-Key": "${REST_API_KEY}"
+     })
+result = json.loads(connection.getresponse().read())
+print result
+
+
+ All of these parameters can be used in combination with each other. For example:
diff --git a/css/lib/multisite/_normalize.scss b/css/lib/multisite/_normalize.scss index e62767358..43cca458d 100644 --- a/css/lib/multisite/_normalize.scss +++ b/css/lib/multisite/_normalize.scss @@ -273,10 +273,10 @@ button, input, select, textarea { - font-size: 100%; - margin: 0; - vertical-align: baseline; - *vertical-align: middle; + font-size: 100%; + margin: 0; + vertical-align: baseline; + *vertical-align: middle; } button, @@ -295,7 +295,7 @@ input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; - *overflow: visible; + *overflow: visible; } button[disabled], @@ -342,3 +342,8 @@ table { border-collapse: collapse; border-spacing: 0; } + +td { + padding-left: 12px; + padding-right: 12px; +} From eb2a382226a1ca77cb90da75ea32e2b8c30126bc Mon Sep 17 00:00:00 2001 From: Tom Fox Date: Sun, 28 Jul 2019 16:21:26 +0100 Subject: [PATCH 4/4] Fix typo --- _includes/rest/queries.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/rest/queries.md b/_includes/rest/queries.md index 47c957c9d..a2acbb84c 100644 --- a/_includes/rest/queries.md +++ b/_includes/rest/queries.md @@ -308,7 +308,7 @@ In addition to `where`, there are several parameters you can use to configure wh | limit | Limit the number of objects returned by the query | | skip | Use with limit to paginate through results | | keys | Restrict the fields returned by the query | -| excludeKeys | Exlcude specific fields from the returned query | +| excludeKeys | Exclude specific fields from the returned query | | include | Use on Pointer columns to return the full object | You can use the `order` parameter to specify a field to sort by. Prefixing with a negative sign reverses the order. Thus, to retrieve scores in ascending order: @@ -1230,4 +1230,4 @@ connection.request('GET', '/parse/ -
\ No newline at end of file +