For the "#-2:0" try to change your query to: select @rid.asString() as rid, Type, Name from Attractions
I don't know your background but you are asking information about the object class (getClass). This is very useful when you need to know what is the object that you are dealing in order to find it specification in the documentation. (Example: http://orientdb.com/javadoc/2.2.x/com/orientechnologies/orient/core/record/impl/ODocument.html). If print(...) something, it will be printed in the log files. Take a look at the example of the log below: root@odb-node1:~# tail -f /orientdb/log/orientdb.log TAGS: starting processing... ===================================== Total Entities to process: 510957 Total Relationships to process: 537349 Total objects to process: 1048306 ================================== class com.orientechnologies.orient.core.record.impl.ODocument class com.orientechnologies.orient.core.record.impl.ODocument class com.orientechnologies.orient.core.db.record.OTrackedMap I recommend you to spend some time looking at how functions should be created in OrientDB: http://pizzaconnections.net/2015/04/02/orientdb-functions-by-samples-1/ And, also take a look at the list below, I've selected some samples that you can adapt and use as you want: var db = orient.getDatabase(); res = db.command('select @rid.asString() as rid,@class.asString as type,data, metadata, location from Companies skip 0 limit 100'); return res.toString(); ==== print('====================================='); print('TAGS: starting processing...'); print('====================================='); //info = com.orientechnologies.common.log.OLogManager.instance().info; // Accessing the database/graph var db = orient.getDatabase(); var mydb = orient.getGraph(); //var result=mydb.getVerticesOfClass('Localidades_brasileiras'); var qres = db.command('select count(*) from Entity'); var countEntity = qres[0].field('count'); print('Total Entities to process: '+countEntity.toString()); var qres = db.command('select count(*) from Relationship'); var countRelationship = qres[0].field('count'); print('Total Relationships to process: '+countRelationship.toString()); print('Total objects to process: '+(countEntity+countRelationship).toString()); var result = db.command('select @rid,metadata,ts from Company limit 10'); if(result!=null){ for(i=0;i<result.length;i++){ print('=================================='); res = result[i]; print(res.getClass()); metadata = res.field('metadata'); print(res.getClass()); print(metadata.getClass()); tags = metadata.get('tags'); print(tags); break; } } return 'Cool'; ==== Hope this help you. Regards André Emilio Toscano 2018-01-15 6:28 GMT-02:00 <[email protected]>: > [email protected] > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/orient-database/topics> > Google > Groups > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > Topic digest > View all topics > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/orient-database/topics> > > - Unwanted fields are returned in sql queries from Function > <#m_2103068243792830140_group_thread_0> - 1 Update > > Unwanted fields are returned in sql queries from Function > <http://groups.google.com/group/orient-database/t/bc8d18947f678043?utm_source=digest&utm_medium=email> > "Ashwini. Kumar" <[email protected]>: Jan 14 03:37PM -0800 > > Hi, > I created a function like this > > ---- > def attractions = orient.getDatabase().query("select @rid, Type, Name > from > Attractions"); > return attractions.getClass(); > ---- > > All I was expecting to get back was rid, type and Name. Instead I am > getting a lot of other attributes like @version , @type, @rid, @fieldTypes. > > > Also, this @rid attribute seems wrong. It starts with a negative number > ("#-2:0") > > These additional unwanted attributes are complicating my middleware and > frontend. Can we just suppress them at the funtion level? > > thanks, > Ashwini > Back to top <#m_2103068243792830140_digest_top> > You received this digest because you're subscribed to updates for this > group. You can change your settings on the group membership page > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/orient-database/join> > . > To unsubscribe from this group and stop receiving emails from it send an > email to [email protected]. > -- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
