GithubHelp home page GithubHelp logo

Comments (8)

oriSomething avatar oriSomething commented on July 20, 2024

might be a bug over there, but why not using a simpler query like this one?

var Community = Parse.Object.extends('Community');
var joinCommunity = Community.createWithoutData('acMv7RpF1l');

new Parse.Query('_User')
  .equalTo('joinCommunity', joinCommunity)
  .find()

from parse-sdk-js.

jclalala avatar jclalala commented on July 20, 2024

We've used Relations for many-to-many relationship between User and Community objects. The query you suggested assumes many-to-one?

from parse-sdk-js.

oriSomething avatar oriSomething commented on July 20, 2024

i don't get it, you've presented a query for one to one relation, did i miss something?
if you want one to many, you can replace equalTo with containedIn. If you're taking about Parse.Relation you gave a wrong query from the beginning.

from parse-sdk-js.

jclalala avatar jclalala commented on July 20, 2024

The query is not just for one-to-one, it can also work when "joinCommunity" attribute is a Relation. When the query is used on relation it returns "all User objects where joinCommunity matches objects returned by the inner query".

The reason why this is a bug is because the same code works on v1.5.0 and not v1.6.2 without modifying a line of code.

from parse-sdk-js.

oriSomething avatar oriSomething commented on July 20, 2024

interesting and good to know. i didn't know you can make matchesQuery on Parse.Relation objects

from parse-sdk-js.

andrewimm avatar andrewimm commented on July 20, 2024

@jclalala can you provide a reproducible test case that succeeds on 1.5.0? I've created what I believe is an analogous setup, and running a query shaped like the one you linked to above fails on both old (1.3.5) and new (1.6.2) versions of the SDK. Are you sure the same code is running on 1.5.0?

from parse-sdk-js.

jclalala avatar jclalala commented on July 20, 2024

hi @andrewimm , please see below fiddlejs for case that has succeeded on v1.5.0.

https://jsfiddle.net/jclalala/x0owjbbs/9/

The same code that fails on v16.2:

https://jsfiddle.net/jclalala/x0owjbbs/

from parse-sdk-js.

andrewimm avatar andrewimm commented on July 20, 2024

Thanks @jclalala, that helped me pinpoint the issue.
You have found a bug, but it should not be a problem if you properly construct your query -- you should be calling new Parse.Query(Parse.User), not new Parse.Query('User'). See the documentation: https://parse.com/docs/js/guide#users-querying

By default, the JS SDK should rewrite 'User' to '_User', unless this behavior is turned off by the developer. While we enabled this feature for subclassing Parse.User in the new SDK, we neglected to do it on query construction as well, since all of our tests use the recommended new Parse.Query(Parse.User) form. I'll make sure the rewrite flag is taken into account, and close this issue when it makes its way into master, but we probably won't release 1.6.5 for another week or so.

In the meantime, just avoid the issue by replacing 'User' with either Parse.User or '_User'

from parse-sdk-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.