Hi, genius
api.parse.com Shutdown,
⇒ npm run import-data
[email protected] import-data /Users/bruceniu/Documents/GitHub/f8app
babel-node ./scripts/import-data-from-parse.js
Loading Speakers
SyntaxError: Unexpected token P in JSON at position 0
at JSON.parse (
at /Users/bruceniu/Documents/GitHub/f8app/node_modules/node-fetch/lib/body.js:43:15
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
code
async function importClass(className) {
console.log('Loading', className);
const response = await fetch(https://api.parse.com/1/classes/${className}, {
method: 'get',
headers: {
'X-Parse-Application-Id': 'R0yDMIKCUyEke2UiadcTBBGd1L5hMBTGJSdBNL3W',
'X-Parse-JavaScript-Key': 'BJ5V0APFMlvmCBPDXl9Mgh3q3dFrs18XkQz6A2bO',
'Content-Type': 'application/json'
},
});
const {results} = await response.json();
const ClassType = Parse.Object.extend(className);
console.log('Cleaning old', className, 'data');
await new Parse.Query(ClassType)
.each(record => record.destroy());
console.log('Converting', className);
return Promise.all(results.map(attrs => importObject(ClassType, attrs)));
}
Thank you very much!
I solve this problem by these steps:
Here is an article(in Chinese) you can refer to: http://www.jianshu.com/p/f7cb35436f9a
@liangxiaowei how install db.zip in linux
@hari-mohan-choudhary
Just unzip it.These files are actually a database copy.In my last answer YOURDATAPATH is the path you unzip db.zip.
You can use mongodb to create a database,and then you will get some database files which has fimilar folder structure as db.zip.
thanks @liangxiaowei
Most helpful comment
I solve this problem by these steps:
###### brew install mongodb
###### mongod --dbpath YOURDATAPATH //the path you just downLoaded
###### mongo
Here is an article(in Chinese) you can refer to: http://www.jianshu.com/p/f7cb35436f9a