function call does not work from oriento

46 views
Skip to first unread message

Roger Gajraj

unread,
Jun 23, 2015, 7:16:02 PM6/23/15
to orient-...@googlegroups.com
No updates to orientdb-community-2.0.10 database are made when function is called from Oriento within nodejs.


I have created a function, myFunction, within studio and it works by adding items to a linklist field called ponections belonging to a vertex of class "Post" having @rid=#13:53 :

...
return db.command("sql", "update #13:53 ADD ponections = [#13:57, #13:53] ");




The function works completely, by adding the data to the "ponections" field, whenever I call it from within studio returning:
{
   
"result": [
       
{
           
"@type": "d",
           
"@version": 0,
           
"value": 1
       
}
   
],
   
"notification": "Query executed in 0.075 sec. Returned 1 record(s)"
}


However, when I call it from oriento using nodejs like so:

db.select('myFunction()').all()
           
.then(function (r) {
                console
.log('response: ', r);
           
});

.. it returns the same values as when called from studio:
[ { '@type': 'd', myFunction: 1, '@rid': { cluster: -2, position: 1 } } ]

BUT NO UPDATES TO THE ponections field of record #13:53 are actually made.

How can I fix this?

Roger Gajraj

unread,
Jun 23, 2015, 7:24:48 PM6/23/15
to orient-...@googlegroups.com

Luca Garulli

unread,
Jun 24, 2015, 6:56:50 PM6/24/15
to orient-...@googlegroups.com
Did you declare you function as idempotent?

Best Regards,

Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB

On 24 June 2015 at 01:24, Roger Gajraj <roger....@gmail.com> wrote:
I am not the first to have this problem. see: https://github.com/codemix/oriento/issues/185

It seems like and Orientdb problem?

On Tuesday, 23 June 2015 19:16:02 UTC-4, Roger Gajraj wrote:
No updates to orientdb-community-2.0.10 database are made when function is called from Oriento within nodejs.


I have created a function, myFunction, within studio and it works by adding items to a linklist field called ponections belonging to a vertex of class "Post" having @rid=#13:53 :

...
return db.command("sql", "update #13:53 ADD ponections = [#13:57, #13:53] ");




The function works completely, by adding the data to the "ponections" field, whenever I call it from within studio returning:
{
   
"result": [
       
{
           
"@type": "d",
           
"@version": 0,
           
"value": 1
       
}
   
],
   
"notification": "Query executed in 0.075 sec. Returned 1 record(s)"
}


However, when I call it from oriento using nodejs like so:

db.select('myFunction()').all()
           
.then(function (r) {
                console
.log('response: ', r);
           
});

.. it returns the same values as when called from studio:
[ { '@type': 'd', myFunction: 1, '@rid': { cluster: -2, position: 1 } } ]

BUT NO UPDATES TO THE ponections field of record #13:53 are actually made.

How can I fix this?

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages