orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.73k stars 871 forks source link

orient variable in server side Javascript function returns OScriptOrientWrapper, even with Graph database #8291

Closed mtveerman closed 3 years ago

mtveerman commented 6 years ago

OrientDB Version: 3.0.1

Java Version: 1.8.0_171

OS: Windows 7

Expected behavior

In Javascript server side function, orient variable should of class OScriptGraphOrientWrapper when using graph database.

Actual behavior

orient variable is of class OScriptOrientWrapper, even on Graph database. Therefore, code like var db = orient.getGraphNoTx(); produces an error.

Steps to reproduce

  1. create new graph database
  2. create javascript function, named testdb
  3. contents of function: print(orient);
  4. run query: select testdb() -> look at console.
luigidellaquila commented 6 years ago

Hi @mtveerman

I think this is related to the fact that OrientGraph is no longer in the classpath, as it implements Apache TinkerPop 2, that was removed from the standard distro and replaced with TinkerPop3 in the orientdb-tp3 distribution

I'll check and let you know

Thanks

Luigi

mtveerman commented 6 years ago

Ok, I understand after reading through some of the docs.

Do I understand it correctly that in v3 I can use the "standaard" database using orient.getDatabase() also for all graph operations?

Maybe an update in the docs is needed: https://orientdb.com/docs/3.0.x/admin/Functions-DB-Access.html

luigidellaquila commented 6 years ago

Hi @mtveerman

Yes, that would be much better. And yes, that page definitely needs a review, let me do it now

Thanks

Luigi

jonsalvas commented 6 years ago

Fortunately I found this thread. I just started with OrientDB and function programming and was really confused when receiving "orient.getGraph() is not a function" although the doc states that the function exists. An update is definitely needed to avoid confusion here.