-
Notifications
You must be signed in to change notification settings - Fork 1
/
seed.js
executable file
·24 lines (24 loc) · 685 Bytes
/
seed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var Syncano = require('syncano'); // CommonJS
var connection = Syncano({
apiKey: '<YOUR_API_KEY>',
defaults: {
instanceName: '<YOUR_INSTANCE_NAME>',
className: 'markers'
}
});
var dataObjects = [];
for (var i = 0; i <= 100; i++) {
dataObjects.push(connection.DataObject({
geo: {
'latitude': Math.floor(Math.random() * (85 - (-85))) - 85,
'longitude': Math.floor(Math.random() * (180 - (-180))) - 180
},
pokemon_id: Math.floor(Math.random() * (151 - 1)) + 1
}));
}
console.log(dataObjects.length);
connection.DataObject
.please()
.bulkCreate(dataObjects)
.then((response) => console.log(response))
.catch((error) => console.log(error));