parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Error load all row in class using where and skip and limit query

Open slickker opened this issue 10 years ago • 10 comments

Describe your issue in as much detail as possible.

I try to load all row in Parse-server class using REST API. This class has 2k rows. I use this query and while loop as change skip and limit value. query = { 'order': 'createdAt', 'skip': skip, 'limit': limit } When skip value met 1000 that is parse-server's max value, I change query. This is my queries. {'skip': 0, 'limit': 100, 'order': 'createdAt'} {'skip': 100, 'limit': 100, 'order': 'createdAt'} . {'skip': 800, 'limit': 100, 'order': 'createdAt'} {'where': {'createdAt': {'$gt': {'__type': 'date', 'iso': '2016-08-11T14:22:19.365Z'}}}, 'skip': 900, 'limit': 100, 'order': 'createdAt'}

But when I use last query, parse-server has error.

error: Error generating response. [ReferenceError: atom is not defined] error: Uncaught internal server error. [ReferenceError: atom is not defined] ReferenceError: atom is not defined

I have no problem when I use previous version. (maybe 2.2.15)

Thanks!!

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

Please see above...sorry

Expected Results

Load all rows in class.

Actual Outcome

error occured.

Environment Setup

  • Server
    • parse-server version: 2.2.17
    • Operating System: OSX 10.11.6
    • Hardware: MacBook Pro 13' 2015
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Localhost
  • Database
    • MongoDB version: 3.0.12
    • Storage engine: -
    • Hardware: MacBook Pro 13' 2015
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Localhost

Logs/Trace

You can turn on additional logging by configuring VERBOSE=1 in your environment.

error: Error generating response. [ReferenceError: atom is not defined] error: Uncaught internal server error. [ReferenceError: atom is not defined] ReferenceError: atom is not defined at transformConstraint (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:499:76) at transformQueryKeyValue (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:202:7) at transformWhere (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:224:15) at MongoStorageAdapter.find (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js:424:59) at /Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Controllers/DatabaseController.js:930:36 at run (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22) at /Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28 at flush (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9) at nextTickCallbackWith0Args (node.js:420:9) at process._tickDomainCallback (node.js:390:13) ReferenceError: atom is not defined at transformConstraint (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:499:76) at transformQueryKeyValue (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:202:7) at transformWhere (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:224:15) at MongoStorageAdapter.find (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js:424:59) at /Users/slickker/workspace/mpoda/mpoda-parse/node_modules/parse-server/lib/Controllers/DatabaseController.js:930:36 at run (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:87:22) at /Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:100:28 at flush (/Users/slickker/workspace/mpoda/mpoda-parse/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9) at nextTickCallbackWith0Args (node.js:420:9) at process._tickDomainCallback (node.js:390:13)

slickker avatar Aug 11 '16 14:08 slickker

Are you accessing your localhost through "atom://"? https://github.com/atom/atom/issues/7773

joeyslack avatar Aug 11 '16 21:08 joeyslack

@joeyslack Hi joeyslack, I'm not use 'atom://'. I use 'http://localhost:1337/parse/classes/'classname'/'parse query' Thanks!

slickker avatar Aug 11 '16 23:08 slickker

@slickker Are you using Atom IDE?

EDIT: Nevermind

joeyslack avatar Aug 11 '16 23:08 joeyslack

We have atom as a variable in the adapter

flovilmart avatar Aug 11 '16 23:08 flovilmart

@joeyslack I use Visual Studio Code editor. But I don't know what relate between this error and editor. I excute node application in terminal.

slickker avatar Aug 12 '16 00:08 slickker

@slickker maybe look at https://github.com/ParsePlatform/parse-server/issues/2326

joeyslack avatar Aug 12 '16 00:08 joeyslack

@joeyslack Thanks. I see #2326 issue. My query is simple and available older version. {'where': {'createdAt': {'$gt': {'__type': 'date', 'iso': '2016-08-11T14:22:19.365Z'}}}, 'skip': 1000, 'limit': 100, 'order': 'createdAt'} => /parse/classes/'classname'?where=%7B%22createdAt%22%3A+%7B%22%24gt%22%3A+%7B%22__type%22%3A+%22date%22%2C+%22iso%22%3A+%222016-08-12T00%3A19%3A26.601Z%22%7D%7D%7D&limit=100&order=createdAt&skip=0

Is this url encode issue?

slickker avatar Aug 12 '16 00:08 slickker

I found the issue of the 'atom is undefined' and posting a fix for that. However it seems that the problem would lie in the URL encoding of your query.

flovilmart avatar Sep 07 '16 00:09 flovilmart

@slickker I see there are some + chars (that denote a spacing in your URI component)

Can you try something like that:

let where = {"createdAt":{"$gt":{"__type":"date","iso":"2016-08-11T14:22:19.365Z"}}},"skip":1000,"limit":100,"order":"createdAt"}
let whereString = JSON.stringify(where);
let encodedWhere = encodeURIComponent(whereString);

with using encodedWhere =>
/parse/classes/'classname'?where=%7B%22createdAt%22%3A%7B%22%24gt%22%3A%7B%22__type%22%3A%22date%22%2C%22iso%22%3A%222016-08-11T14%3A22%3A19.365Z%22%7D%7D%7D

flovilmart avatar Sep 07 '16 00:09 flovilmart

@slickker can you update to latest version of parse-server and reopen if the issue still persists.

flovilmart avatar Oct 22 '16 04:10 flovilmart