Skip to content

GET on collection with 'sort' parameter fails #1786

Closed

Description

@araskin

Check out #1271 for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!

Many members of the community use Stack Overflow and Server Fault to ask questions. Read through the existing questions or ask your own!

For database migration help, please file a bug report at https://parse.com/help#report

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

  • Server: 2.2.9 , Max OS X 10.11.14, Macbook Air, local?
  • Database: ??, AWS, hardware ??, remote?

Steps to reproduce

When the following code is called

                $.ajax({

                    url: "http://localhost:1337/parse/classes/SocialPosting/",
                    dataType: "son",
                    type:"GET",
                    headers: appModel.parse._headers,

                    data:{where: kendo.stringify(
                            {
                                'vendor':appModel.getParsePointer(appModel.parse._vendor, "Vendor"),
                                'autoGenerated':options.data.autoGenerated
                            }
                        ),sort:"_createdAt"},
                    success: function(jsonResponse) {
                        options.success(jsonResponse.results);
                    },

                    error: function(jqXHR,textStatus,errorThrown) {
                        options.error(options.data);
                    }
                });

            },

The response is

{"code":102,"error":"Invalid paramater for query: sort"}

Of course if we remove the sort then everything works fine.

Activity

  1. drew-gross commented on May 13, 2016

    @drew-gross
    Contributor

    _createdAt is not a valid key. Try _created_at or createdAt.

  2. araskin commented on May 13, 2016

    @araskin
    Author

    Tried both. No change in behavior. @drew-gross

  3. drew-gross commented on May 13, 2016

    @drew-gross
    Contributor

    I checked with api.parse.com, and api.parse.com won't crash if you pass a "sort" parameter, but it also won't actually sort the data. The parameter you need to use is "order".

  4. araskin commented on May 13, 2016

    @araskin
    Author

    Thanks Drew. That did the trick. I guess it was a bug that we brought over from Parse.com. Once I changed it to order I then get the exception that _createdAt is not a valid key. Once I changed it to createdAt everything works.

    Thank you. Please close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions