Monday, 3 April 2017

Node.js ,JSON output

Hellow , I dont know how to put this but i have the below code to connect to orientdb then im running a query against a class, everything is working fine .

enter code here
  // app/index.js
    //below the API to intiallize SERVER
    var Oriento = require('orientjs');

    var server = Oriento({
      host: 'xxxxxx',
      port: 2424,
      username: 'root',
      password: 'password'
    });
    // below is to initial database API 
    var db = server.use({
                            name: 'DBname',
                            username: 'root',
                            password: 'password'

                    });

    console.log('Iam using :', db.name) ;
     db.open().then(function() {
       return db.query('SELECT FROM customers where @rid=12:1');
       }).then(function(res){
        console.log(res);
       db.close().then(function(){
            console.log('closed');
            });
                  });

the result of the query is an output in JSON format My question is : I want each property returned of that query to be saved within a variable

Note: why i want this? because i want to insert these variables into relational database....Am i following the right strategy ? if not please tell me what i can do

Thanks ,



via Abdelellah Dandashi

No comments:

Post a Comment