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

Function transformKey

src/Adapters/Storage/Mongo/MongoTransform.js:7–31  ·  view source on GitHub ↗
(className, fieldName, schema)

Source from the content-addressed store, hash-verified

5const Utils = require('../../../Utils');
6
7const transformKey = (className, fieldName, schema) => {
8 // Check if the schema is known since it's a built-in field.
9 switch (fieldName) {
10 case 'objectId':
11 return '_id';
12 case 'createdAt':
13 return '_created_at';
14 case 'updatedAt':
15 return '_updated_at';
16 case 'sessionToken':
17 return '_session_token';
18 case 'lastUsed':
19 return '_last_used';
20 case 'timesUsed':
21 return 'times_used';
22 }
23
24 if (schema.fields[fieldName] && schema.fields[fieldName].__type == 'Pointer') {
25 fieldName = '_p_' + fieldName;
26 } else if (schema.fields[fieldName] && schema.fields[fieldName].type == 'Pointer') {
27 fieldName = '_p_' + fieldName;
28 }
29
30 return fieldName;
31};
32
33const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSchema) => {
34 // Check if the schema is known since it's a built-in field.

Callers 4

findMethod · 0.90
ensureIndexMethod · 0.90
ensureUniquenessMethod · 0.90
distinctMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…