Skip to content

query.include() does not include the relation objects #4138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
srameshr opened this issue Sep 7, 2017 · 13 comments
Closed

query.include() does not include the relation objects #4138

srameshr opened this issue Sep 7, 2017 · 13 comments

Comments

@srameshr
Copy link
Contributor

srameshr commented Sep 7, 2017

Issue Description

query.include() does not include the relation objects

Steps to reproduce

  1. A parse class called Test has a relation to User class on column userRel.
  2. Cloude code:
  const Test = Parse.Object.extend('Test');
  const query = new Parse.Query(Test);
  query.equalTo('createdBy', request.user);
  query.include('userRel');
  query.first();
  1. The response just includes "userRel":{"__type":"Relation","className":"_User"}.

Expected Results

The whole user object should be sent in response.

Actual Outcome

The response just includes "userRel":{"__type":"Relation","className":"_User"} even though 5 users are in this relation.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : "parse": "^1.10.0", "parse-server":"^2.5.3"
    • Operating System: MAC
    • Hardware:
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Localhost
  • Database

    • MongoDB version: 3.x
    • Storage engine:
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Local

Logs/Trace

Include all relevant logs. You can turn on additional logging by configuring VERBOSE=1 in your environment.

@natanrolnik
Copy link
Contributor

@srameshr If that property is a Relation, yes, it won't include the results. You need to do testObject.get('userRel').query().find(). If you want include() to work as you are expecting, you should store the user as Pointers instead.

@natanrolnik
Copy link
Contributor

You can read more here:
http://docs.parseplatform.org/js/guide/#relations

@srameshr
Copy link
Contributor Author

srameshr commented Sep 7, 2017

@natanrolnik How do I select few fields from the User object from this query?

  const relQuery = testObject.get('userRel').query();
  // userRel has a createdBy field which is a pointer to User class.
  relQuery.include('createdBy');
  relQuery.select('createdBy.name', 'createdBy.email', 'createdBy.avatar');
  relQuery.find();

The response does not include any fields from testObject except for createdAt, ObjectId and createdBy. createdBy contains the whole class.

@natanrolnik
Copy link
Contributor

I'm pretty sure that query.select() doesn't support nesting. If you don't apply select, is the User object returned correctly?

@srameshr
Copy link
Contributor Author

srameshr commented Sep 7, 2017

It (nesting) used to work previously with "parse": "~1.8.0", "parse-server": "^2.4.0",. If I dont apply include or select the whole user object is returned.

In detail:

  1. Class by A contains a relation to another class by name B
  2. B has a pointer by name createdBy to the User class. User class contains name, avatar and many fields.

Now when I query for A I want the object B with B I want createdBy to be included with just name and avatar field.

@flovilmart
Copy link
Contributor

If nested select used to work, there’s a regression; but I highly doubt we’d introduce such regression without breaking a few tests.

@srameshr
Copy link
Contributor Author

srameshr commented Sep 7, 2017

@flovilmart I agree. Or was it some bug on my end? Im not sure! Any answer to the detail part in my previous comment?

@flovilmart
Copy link
Contributor

actually, it seems heavily covered already...

https://github.com/parse-community/parse-server/blob/master/spec/ParseQuery.spec.js#L2844

What version of the server are you running? Can you provide verbose logs when running this query?

@srameshr
Copy link
Contributor Author

srameshr commented Sep 7, 2017

foobarQuery.select(['fizz', 'barBaz.key']);

This selection is not working for me. I will update with the logs.

@flovilmart
Copy link
Contributor

Yeah, and it’s properly teSted and covered on each release.

@srameshr
Copy link
Contributor Author

srameshr commented Sep 7, 2017

verbose: REQUEST for [POST] /parse/functions/get_contents: {} method=POST, url=/parse/functions/get_contents, host=localhost:1337, content-type=text/plain, connection=keep-alive, if-none-match=W/"14b0-HRZvjT8i6cNKAmt27ZfFWO66BH0", accept=*/*, accept-language=en-us, content-length=203, accept-encoding=gzip, deflate, user-agent=appName/1 CFNetwork/758.0.2 Darwin/15.6.0, 
verbose: REQUEST for [GET] /parse/classes/Content: {
  "where": {
    "tagged": {
      "__type": "Pointer",
      "className": "_User",
      "objectId": "4fLd2YzSfm"
    }
  }
} method=GET, url=/parse/classes/Content, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=242, connection=close, __type=Pointer, className=_User, objectId=4fLd2YzSfm
verbose: RESPONSE from [GET] /parse/classes/Content: {
  "response": {
    "results": [
      {
        "objectId": "5xLzXSGAq0",
        "caption": "hello world",
        "createdAt": "2017-09-06T17:36:00.356Z",
        "updatedAt": "2017-09-06T17:36:00.356Z",
        "tagged": {
          "__type": "Relation",
          "className": "_User"
        },
        "media": {
          "__type": "Relation",
          "className": "Media"
        }
      },
      {
        "objectId": "D9ljbOnQ3F",
        "caption": "Test",
        "createdAt": "2017-09-07T10:45:54.084Z",
        "updatedAt": "2017-09-07T11:04:57.945Z",
        "tagged": {
          "__type": "Relation",
          "className": "_User"
        },
        "media": {
          "__type": "Relation",
          "className": "Media"
        }
      },
      {
        "objectId": "Z72DFPp4I0",
        "caption": "hello",
        "createdAt": "2017-09-07T08:08:29.184Z",
        "updatedAt": "2017-09-07T08:08:29.184Z",
        "tagged": {
          "__type": "Relation",
          "className": "_User"
        },
        "media": {
          "__type": "Relation",
          "className": "Media"
        }
      }
    ]
  }
} results=[objectId=5xLzXSGAq0, caption=hello world, createdAt=2017-09-06T17:36:00.356Z, updatedAt=2017-09-06T17:36:00.356Z, __type=Relation, className=_User, __type=Relation, className=Media, objectId=D9ljbOnQ3F, caption=Test, createdAt=2017-09-07T10:45:54.084Z, updatedAt=2017-09-07T11:04:57.945Z, __type=Relation, className=_User, __type=Relation, className=Media, objectId=Z72DFPp4I0, caption=hello, createdAt=2017-09-07T08:08:29.184Z, updatedAt=2017-09-07T08:08:29.184Z, __type=Relation, className=_User, __type=Relation, className=Media]
verbose: REQUEST for [GET] /parse/classes/Media: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "5xLzXSGAq0"
      },
      "key": "media"
    }
  },
  "include": "createdBy",
  "keys": "createdBy.name,createdBy.avatar,media,position"
} method=GET, url=/parse/classes/Media, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=351, connection=close, __type=Pointer, className=Content, objectId=5xLzXSGAq0, key=media, include=createdBy, keys=createdBy.name,createdBy.avatar,media,position
verbose: REQUEST for [GET] /parse/classes/Media: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "Z72DFPp4I0"
      },
      "key": "media"
    }
  },
  "include": "createdBy",
  "keys": "createdBy.name,createdBy.avatar,media,position"
} method=GET, url=/parse/classes/Media, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=351, connection=close, __type=Pointer, className=Content, objectId=Z72DFPp4I0, key=media, include=createdBy, keys=createdBy.name,createdBy.avatar,media,position
verbose: REQUEST for [GET] /parse/classes/Media: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "D9ljbOnQ3F"
      },
      "key": "media"
    }
  },
  "include": "createdBy",
  "keys": "createdBy.name,createdBy.avatar,media,position"
} method=GET, url=/parse/classes/Media, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=351, connection=close, __type=Pointer, className=Content, objectId=D9ljbOnQ3F, key=media, include=createdBy, keys=createdBy.name,createdBy.avatar,media,position
verbose: RESPONSE from [GET] /parse/classes/Media: {
  "response": {
    "results": [
      {
        "objectId": "BB1nTnjs04",
        "media": {
          "__type": "File",
          "name": "7f74596bd3453724400155a383e99ada_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/7f74596bd3453724400155a383e99ada_frill-media.jpeg"
        },
        "position": 1,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-06T17:36:00.240Z",
        "updatedAt": "2017-09-06T17:36:00.240Z"
      },
      {
        "objectId": "BCBshEi7LI",
        "media": {
          "__type": "File",
          "name": "e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg"
        },
        "position": 2,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-06T17:36:00.239Z",
        "updatedAt": "2017-09-06T17:36:00.239Z"
      },
      {
        "objectId": "rTAsH4w629",
        "media": {
          "__type": "File",
          "name": "fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg"
        },
        "position": 0,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-06T17:36:00.240Z",
        "updatedAt": "2017-09-06T17:36:00.240Z"
      }
    ]
  }
} results=[objectId=BB1nTnjs04, __type=File, name=7f74596bd3453724400155a383e99ada_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/7f74596bd3453724400155a383e99ada_frill-media.jpeg, position=1, objectId=4fLd2YzSfm, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, __type=Object, className=_User, createdAt=2017-09-06T17:36:00.240Z, updatedAt=2017-09-06T17:36:00.240Z, objectId=BCBshEi7LI, __type=File, name=e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg, position=2, $ref=$["result"]["response"]["results"][0]["createdBy"], createdAt=2017-09-06T17:36:00.239Z, updatedAt=2017-09-06T17:36:00.239Z, objectId=rTAsH4w629, __type=File, name=fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg, position=0, $ref=$["result"]["response"]["results"][0]["createdBy"], createdAt=2017-09-06T17:36:00.240Z, updatedAt=2017-09-06T17:36:00.240Z]
verbose: RESPONSE from [GET] /parse/classes/Media: {
  "response": {
    "results": [
      {
        "objectId": "9Lc5eutYV4",
        "media": {
          "__type": "File",
          "name": "39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg"
        },
        "position": 0,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-07T08:08:28.998Z",
        "updatedAt": "2017-09-07T08:08:28.998Z"
      }
    ]
  }
} results=[objectId=9Lc5eutYV4, __type=File, name=39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg, position=0, objectId=4fLd2YzSfm, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, __type=Object, className=_User, createdAt=2017-09-07T08:08:28.998Z, updatedAt=2017-09-07T08:08:28.998Z]
verbose: RESPONSE from [GET] /parse/classes/Media: {
  "response": {
    "results": [
      {
        "objectId": "Nx2P7FxVfx",
        "media": {
          "__type": "File",
          "name": "45ef54282f6e3de5e478a049654e99fc_xneofzwh.png",
          "url": "http://localhost:1337/parse/files/appName_app/45ef54282f6e3de5e478a049654e99fc_xneofzwh.png"
        },
        "createdAt": "2017-09-07T11:04:15.338Z",
        "updatedAt": "2017-09-07T11:04:23.337Z",
        "createdBy": {
          "objectId": "D8fBagRbf4",
          "createdAt": "2017-08-30T16:46:43.433Z",
          "updatedAt": "2017-09-04T13:41:53.511Z",
          "name": "John",
          "avatar": {
            "__type": "File",
            "name": "cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png",
            "url": "http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png"
          },
          "__type": "Object",
          "className": "_User"
        },
        "position": 0
      },
      {
        "objectId": "aKRIs8otGS",
        "media": {
          "__type": "File",
          "name": "b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg"
        },
        "position": 0,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-07T10:45:54.000Z",
        "updatedAt": "2017-09-07T10:45:54.000Z"
      },
      {
        "objectId": "hXUVqRt1Ur",
        "media": {
          "__type": "File",
          "name": "54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg",
          "url": "http://localhost:1337/parse/files/appName_app/54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg"
        },
        "position": 1,
        "createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },
        "createdAt": "2017-09-07T10:45:53.998Z",
        "updatedAt": "2017-09-07T10:45:53.998Z"
      }
    ]
  }
} results=[objectId=Nx2P7FxVfx, __type=File, name=45ef54282f6e3de5e478a049654e99fc_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/45ef54282f6e3de5e478a049654e99fc_xneofzwh.png, createdAt=2017-09-07T11:04:15.338Z, updatedAt=2017-09-07T11:04:23.337Z, objectId=D8fBagRbf4, createdAt=2017-08-30T16:46:43.433Z, updatedAt=2017-09-04T13:41:53.511Z, name=John, __type=File, name=cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, __type=Object, className=_User, position=0, objectId=aKRIs8otGS, __type=File, name=b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg, position=0, objectId=4fLd2YzSfm, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, __type=Object, className=_User, createdAt=2017-09-07T10:45:54.000Z, updatedAt=2017-09-07T10:45:54.000Z, objectId=hXUVqRt1Ur, __type=File, name=54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg, position=1, $ref=$["result"]["response"]["results"][1]["createdBy"], createdAt=2017-09-07T10:45:53.998Z, updatedAt=2017-09-07T10:45:53.998Z]
verbose: REQUEST for [GET] /parse/classes/_User: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "5xLzXSGAq0"
      },
      "key": "tagged"
    }
  },
  "keys": "name,avatar,username"
} method=GET, url=/parse/classes/_User, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=304, connection=close, __type=Pointer, className=Content, objectId=5xLzXSGAq0, key=tagged, keys=name,avatar,username
verbose: REQUEST for [GET] /parse/classes/_User: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "Z72DFPp4I0"
      },
      "key": "tagged"
    }
  },
  "keys": "name,avatar,username"
} method=GET, url=/parse/classes/_User, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=304, connection=close, __type=Pointer, className=Content, objectId=Z72DFPp4I0, key=tagged, keys=name,avatar,username
verbose: REQUEST for [GET] /parse/classes/_User: {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Content",
        "objectId": "D9ljbOnQ3F"
      },
      "key": "tagged"
    }
  },
  "keys": "name,avatar,username"
} method=GET, url=/parse/classes/_User, user-agent=node-XMLHttpRequest, Parse/js1.10.0 (NodeJS 8.3.0), accept=*/*, content-type=text/plain, host=localhost:1337, content-length=304, connection=close, __type=Pointer, className=Content, objectId=D9ljbOnQ3F, key=tagged, keys=name,avatar,username
verbose: RESPONSE from [GET] /parse/classes/_User: {
  "response": {
    "results": [
      {
        "objectId": "4fLd2YzSfm",
        "name": "Siddharth",
        "username": "7259396957",
        "avatar": {
          "__type": "File",
          "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
          "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
        },
        "createdAt": "2017-08-30T16:20:39.342Z",
        "updatedAt": "2017-08-31T18:08:02.220Z"
      }
    ]
  }
} results=[objectId=4fLd2YzSfm, name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z]
verbose: RESPONSE from [GET] /parse/classes/_User: {
  "response": {
    "results": [
      {
        "objectId": "4fLd2YzSfm",
        "name": "Siddharth",
        "username": "7259396957",
        "avatar": {
          "__type": "File",
          "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
          "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
        },
        "createdAt": "2017-08-30T16:20:39.342Z",
        "updatedAt": "2017-08-31T18:08:02.220Z"
      }
    ]
  }
} results=[objectId=4fLd2YzSfm, name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z]
verbose: RESPONSE from [GET] /parse/classes/_User: {
  "response": {
    "results": [
      {
        "objectId": "4fLd2YzSfm",
        "name": "Siddharth",
        "username": "7259396957",
        "avatar": {
          "__type": "File",
          "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
          "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
        },
        "createdAt": "2017-08-30T16:20:39.342Z",
        "updatedAt": "2017-08-31T18:08:02.220Z"
      },
      {
        "objectId": "D8fBagRbf4",
        "username": "8885555512",
        "createdAt": "2017-08-30T16:46:43.433Z",
        "updatedAt": "2017-09-04T13:41:53.511Z",
        "name": "John",
        "avatar": {
          "__type": "File",
          "name": "cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png",
          "url": "http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png"
        }
      }
    ]
  }
} results=[objectId=4fLd2YzSfm, name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=D8fBagRbf4, username=8885555512, createdAt=2017-08-30T16:46:43.433Z, updatedAt=2017-09-04T13:41:53.511Z, name=John, __type=File, name=cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png]
info: Ran cloud function get_contents for user 4fLd2YzSfm with:
  Input: {}
  Result: {"data":[{"content":{"caption":"hello world","createdAt":"2017-09-06T17:36:00.356Z","updatedAt":"2017-09-06T17:36:00.356Z","tagged":{"__type":"Relation","className":"_User"},"media":{"__type":"Relation","className":"Media"},"objectId":"5xLzXSGAq0","__type":"Object","className":"Content"},"medias":[{"media":{"__type":"File","name":"7f74596bd3453724400155a383e99ada_frill-media.jpeg","url":"http://localhost:1337/parse/files/appName_app/7f74596bd3453724400155a383e99ada_frill-media.jpeg"},"position":1,"createdBy":{"name":"Siddharth","avatar":{"__type":"File","name":"deb4dcc4accee9d1d20e6e0f64c2e382_appName.png","url":"http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"},"createdAt":"2017-08-30T16:20:39.342Z","updatedAt":"2017-08-31T18:08:02.220Z","objectId":"4fLd2YzSfm","__type":"Object","className":"_User"},"createdAt":"2017-09-06T17:36:00.240Z","updatedAt":"2017-09-06T17:36:00.240Z","objectId":"BB1nTnjs04","__type":"Object","className":"Media"},{"media"... (truncated) functionName=get_contents, , user=4fLd2YzSfm
verbose: RESPONSE from [POST] /parse/functions/get_contents: {
  "response": {
    "result": {
      "data": [
        {
          "content": {
            "caption": "hello world",
            "createdAt": "2017-09-06T17:36:00.356Z",
            "updatedAt": "2017-09-06T17:36:00.356Z",
            "tagged": {
              "__type": "Relation",
              "className": "_User"
            },
            "media": {
              "__type": "Relation",
              "className": "Media"
            },
            "objectId": "5xLzXSGAq0",
            "__type": "Object",
            "className": "Content"
          },
          "medias": [
            {
              "media": {
                "__type": "File",
                "name": "7f74596bd3453724400155a383e99ada_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/7f74596bd3453724400155a383e99ada_frill-media.jpeg"
              },
              "position": 1,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-06T17:36:00.240Z",
              "updatedAt": "2017-09-06T17:36:00.240Z",
              "objectId": "BB1nTnjs04",
              "__type": "Object",
              "className": "Media"
            },
            {
              "media": {
                "__type": "File",
                "name": "e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg"
              },
              "position": 2,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-06T17:36:00.239Z",
              "updatedAt": "2017-09-06T17:36:00.239Z",
              "objectId": "BCBshEi7LI",
              "__type": "Object",
              "className": "Media"
            },
            {
              "media": {
                "__type": "File",
                "name": "fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg"
              },
              "position": 0,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-06T17:36:00.240Z",
              "updatedAt": "2017-09-06T17:36:00.240Z",
              "objectId": "rTAsH4w629",
              "__type": "Object",
              "className": "Media"
            }
          ],
          "tagged": [
            {
              "name": "Siddharth",
              "username": "7259396957",
              "avatar": {
                "__type": "File",
                "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
              },
              "createdAt": "2017-08-30T16:20:39.342Z",
              "updatedAt": "2017-08-31T18:08:02.220Z",
              "objectId": "4fLd2YzSfm",
              "__type": "Object",
              "className": "_User"
            }
          ]
        },
        {
          "content": {
            "caption": "Test",
            "createdAt": "2017-09-07T10:45:54.084Z",
            "updatedAt": "2017-09-07T11:04:57.945Z",
            "tagged": {
              "__type": "Relation",
              "className": "_User"
            },
            "media": {
              "__type": "Relation",
              "className": "Media"
            },
            "objectId": "D9ljbOnQ3F",
            "__type": "Object",
            "className": "Content"
          },
          "medias": [
            {
              "media": {
                "__type": "File",
                "name": "45ef54282f6e3de5e478a049654e99fc_xneofzwh.png",
                "url": "http://localhost:1337/parse/files/appName_app/45ef54282f6e3de5e478a049654e99fc_xneofzwh.png"
              },
              "createdAt": "2017-09-07T11:04:15.338Z",
              "updatedAt": "2017-09-07T11:04:23.337Z",
              "createdBy": {
                "createdAt": "2017-08-30T16:46:43.433Z",
                "updatedAt": "2017-09-04T13:41:53.511Z",
                "name": "John",
                "avatar": {
                  "__type": "File",
                  "name": "cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png",
                  "url": "http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png"
                },
                "objectId": "D8fBagRbf4",
                "__type": "Object",
                "className": "_User"
              },
              "position": 0,
              "objectId": "Nx2P7FxVfx",
              "__type": "Object",
              "className": "Media"
            },
            {
              "media": {
                "__type": "File",
                "name": "b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg"
              },
              "position": 0,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-07T10:45:54.000Z",
              "updatedAt": "2017-09-07T10:45:54.000Z",
              "objectId": "aKRIs8otGS",
              "__type": "Object",
              "className": "Media"
            },
            {
              "media": {
                "__type": "File",
                "name": "54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg"
              },
              "position": 1,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-07T10:45:53.998Z",
              "updatedAt": "2017-09-07T10:45:53.998Z",
              "objectId": "hXUVqRt1Ur",
              "__type": "Object",
              "className": "Media"
            }
          ],
          "tagged": [
            {
              "name": "Siddharth",
              "username": "7259396957",
              "avatar": {
                "__type": "File",
                "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
              },
              "createdAt": "2017-08-30T16:20:39.342Z",
              "updatedAt": "2017-08-31T18:08:02.220Z",
              "objectId": "4fLd2YzSfm",
              "__type": "Object",
              "className": "_User"
            },
            {
              "username": "8885555512",
              "createdAt": "2017-08-30T16:46:43.433Z",
              "updatedAt": "2017-09-04T13:41:53.511Z",
              "name": "John",
              "avatar": {
                "__type": "File",
                "name": "cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png",
                "url": "http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png"
              },
              "objectId": "D8fBagRbf4",
              "__type": "Object",
              "className": "_User"
            }
          ]
        },
        {
          "content": {
            "caption": "hello",
            "createdAt": "2017-09-07T08:08:29.184Z",
            "updatedAt": "2017-09-07T08:08:29.184Z",
            "tagged": {
              "__type": "Relation",
              "className": "_User"
            },
            "media": {
              "__type": "Relation",
              "className": "Media"
            },
            "objectId": "Z72DFPp4I0",
            "__type": "Object",
            "className": "Content"
          },
          "medias": [
            {
              "media": {
                "__type": "File",
                "name": "39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg",
                "url": "http://localhost:1337/parse/files/appName_app/39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg"
              },
              "position": 0,
              "createdBy": {
                "name": "Siddharth",
                "avatar": {
                  "__type": "File",
                  "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                  "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
                },
                "createdAt": "2017-08-30T16:20:39.342Z",
                "updatedAt": "2017-08-31T18:08:02.220Z",
                "objectId": "4fLd2YzSfm",
                "__type": "Object",
                "className": "_User"
              },
              "createdAt": "2017-09-07T08:08:28.998Z",
              "updatedAt": "2017-09-07T08:08:28.998Z",
              "objectId": "9Lc5eutYV4",
              "__type": "Object",
              "className": "Media"
            }
          ],
          "tagged": [
            {
              "name": "Siddharth",
              "username": "7259396957",
              "avatar": {
                "__type": "File",
                "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
                "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
              },
              "createdAt": "2017-08-30T16:20:39.342Z",
              "updatedAt": "2017-08-31T18:08:02.220Z",
              "objectId": "4fLd2YzSfm",
              "__type": "Object",
              "className": "_User"
            }
          ]
        }
      ]
    }
  }
} data=[caption=hello world, createdAt=2017-09-06T17:36:00.356Z, updatedAt=2017-09-06T17:36:00.356Z, __type=Relation, className=_User, __type=Relation, className=Media, objectId=5xLzXSGAq0, __type=Object, className=Content, medias=[__type=File, name=7f74596bd3453724400155a383e99ada_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/7f74596bd3453724400155a383e99ada_frill-media.jpeg, position=1, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-06T17:36:00.240Z, updatedAt=2017-09-06T17:36:00.240Z, objectId=BB1nTnjs04, __type=Object, className=Media, __type=File, name=e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/e40948dd314345b9eec6ee71aa57500c_frill-media.jpeg, position=2, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-06T17:36:00.239Z, updatedAt=2017-09-06T17:36:00.239Z, objectId=BCBshEi7LI, __type=Object, className=Media, __type=File, name=fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/fb55ec0fff106f70b779da72e9af2233_frill-media.jpeg, position=0, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-06T17:36:00.240Z, updatedAt=2017-09-06T17:36:00.240Z, objectId=rTAsH4w629, __type=Object, className=Media], tagged=[name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User], caption=Test, createdAt=2017-09-07T10:45:54.084Z, updatedAt=2017-09-07T11:04:57.945Z, __type=Relation, className=_User, __type=Relation, className=Media, objectId=D9ljbOnQ3F, __type=Object, className=Content, medias=[__type=File, name=45ef54282f6e3de5e478a049654e99fc_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/45ef54282f6e3de5e478a049654e99fc_xneofzwh.png, createdAt=2017-09-07T11:04:15.338Z, updatedAt=2017-09-07T11:04:23.337Z, createdAt=2017-08-30T16:46:43.433Z, updatedAt=2017-09-04T13:41:53.511Z, name=John, __type=File, name=cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, objectId=D8fBagRbf4, __type=Object, className=_User, position=0, objectId=Nx2P7FxVfx, __type=Object, className=Media, __type=File, name=b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/b7e695e7ca19a5d274d048382db23b46_frill-media.jpeg, position=0, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-07T10:45:54.000Z, updatedAt=2017-09-07T10:45:54.000Z, objectId=aKRIs8otGS, __type=Object, className=Media, __type=File, name=54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/54a02bbd013d0ebc52c3b931f826a00e_frill-media.jpeg, position=1, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-07T10:45:53.998Z, updatedAt=2017-09-07T10:45:53.998Z, objectId=hXUVqRt1Ur, __type=Object, className=Media], tagged=[name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, username=8885555512, createdAt=2017-08-30T16:46:43.433Z, updatedAt=2017-09-04T13:41:53.511Z, name=John, __type=File, name=cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, url=http://localhost:1337/parse/files/appName_app/cf43ade4c3bcf7f918d72ea5cc8241c5_xneofzwh.png, objectId=D8fBagRbf4, __type=Object, className=_User], caption=hello, createdAt=2017-09-07T08:08:29.184Z, updatedAt=2017-09-07T08:08:29.184Z, __type=Relation, className=_User, __type=Relation, className=Media, objectId=Z72DFPp4I0, __type=Object, className=Content, medias=[__type=File, name=39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg, url=http://localhost:1337/parse/files/appName_app/39a6972cb9f991e6fa6f1a420cd68def_frill-media.jpeg, position=0, name=Siddharth, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User, createdAt=2017-09-07T08:08:28.998Z, updatedAt=2017-09-07T08:08:28.998Z, objectId=9Lc5eutYV4, __type=Object, className=Media], tagged=[name=Siddharth, username=7259396957, __type=File, name=deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, url=http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png, createdAt=2017-08-30T16:20:39.342Z, updatedAt=2017-08-31T18:08:02.220Z, objectId=4fLd2YzSfm, __type=Object, className=_User]]

@flovilmart
Copy link
Contributor

flovilmart commented Sep 7, 2017

looks like it's working as expected to me.

keys: "createdBy.name,createdBy.avatar,media,position"
"createdBy": {
          "objectId": "4fLd2YzSfm",
          "name": "Siddharth",
          "avatar": {
            "__type": "File",
            "name": "deb4dcc4accee9d1d20e6e0f64c2e382_appName.png",
            "url": "http://localhost:1337/parse/files/appName_app/deb4dcc4accee9d1d20e6e0f64c2e382_appName.png"
          },
          "createdAt": "2017-08-30T16:20:39.342Z",
          "updatedAt": "2017-08-31T18:08:02.220Z",
          "__type": "Object",
          "className": "_User"
        },

the default keys updatedAt, createdAt etc.. will always be included in the response.

@Tarbez
Copy link

Tarbez commented Feb 8, 2022

Doesn't this supposedly bring the liked posts from the current user?

const theUser = Moralis.User.current();
    const query = new Moralis.Query(theUser);
    query.include("likes");

    const comments = await query.find();
    console.log(comments[0]);
    const testMode = comments[0].get('likes');
    console.log(testMode);

I keep getting this result:
{"__type":"Relation","className":"post"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants