How to use the parse-server/lib/Adapters/Storage/Mongo/MongoTransform.mongoObjectToParseObject function in parse-server

To help you get started, we’ve selected a few parse-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benishak / parse-server-dynamodb-adapter / src / Adapter.ts View on Github external
Transform.transformToParseObject = (className, mongoObject, schema) => {
    const object = Transform.mongoObjectToParseObject(className, mongoObject, schema);
    if (object instanceof Object) {
        Object.keys(schema.fields|| {}).forEach(k => {
            if ((schema.fields[k].type || '').toLowerCase() == 'date' && typeof object[k] == 'string' && ['createdAt', 'updatedAt'].indexOf(k) == -1) {
                object[k] = Parse._encode(new Date(object[k]));
            }
        });

        if (className == '_User') {
            if (object['_password_changed_at']) {
                object['_password_changed_at'] = Parse._encode(new Date(object['_password_changed_at']));
            }

            if (object['_email_verify_token_expires_at']) {
                object['_email_verify_token_expires_at'] = Parse._encode(new Date(object['_email_verify_token_expires_at']));
            }
        }