Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/paraffin/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: // In a node.js environment
var Parse = require('parse/node')
Parse.initialize('APP_ID', 'JAVASCRIPT_KEY', 'MASTER_KEY')
// javascriptKey is required only if you have it on server.
Parse.serverURL = 'http://0.0.0.0:1337/parse' //Change this value to Parse Server API URL.
// documents to be inserted
var docs = [
{
name: 'mohammad',
clientId: 'u103',
secret: { type: 'openid', pwdhash: 'rasoul' },
adapter: ['coap'],
topics: ['hello', 'username', 'mahdi/hello', 'mohammad']
},
{
name: 'mahdi',
clientId: 'm313',
secret: { type: 'openid', pwdhash: 'adrekni' },
adapter: ['mqtt', 'http'],
topics: ['hello', 'username', 'mahdi/hello']
},
{
name: 'ali',
clientId: 'a110',
secret: { type: 'openid', pwdhash: 'yaAli' },
adapter: ['http'],
topics: ['hello', 'ali', 'ali/home']
},
{
name: 'username',
clientId: 'u911',
secret: { type: 'openid', pwdhash: 'password' },
adapter: ['*'],
topics: [
'hello',
'username',
'mahdi/hello',
'ali/home',
'mohammad/light',
'username/home',
'username/kitchen'
]
}
]
console.log('Inserting Demo Docs is Starting')
saving(docs)
function saving (docs) {
for (let i = 0; i < docs.length; i++) {
var Device = Parse.Object.extend(docs[i].name.toString())
var device = new Device()
device.save(docs[i]).then(
device => {
console.log('Doc [' + i + ']')
console.log(device)
// The object was saved successfully.
},
error => {
console.log('Error: ' + error)
// The save failed.
// error is a Parse.Error with an error code and message.
}
)
}
}
console.log('Inserting Demo Docs is Finished.')
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]-- |