Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Error running the native query
PostPosted: Sun Feb 12, 2017 11:42 pm 
Newbie

Joined: Sun Feb 12, 2017 11:28 pm
Posts: 2
I have a collection named user_interaction.
Whenever i run the application i get and error following error. My query is somewhat like the one below.
db.user_interaction.aggregate([ {'$unwind':'$page_session'}, {'$unwind': '$page_session.click'}, {'$match' : {'page_session.click.resource_name':'campaign'}}, {'$group':{ '_id':'$page_session.click.resource_id', 'averageSessionDuration': {'$avg':'$page_session.timespent'}, 'viewerCount':{'$sum':1} }}])

it works fine on Mongo Shell though.


Caused by: org.bson.json.JsonParseException: JSON reader was expecting a value but found 'db'.
at org.bson.json.JsonReader.readBsonType(JsonReader.java:237) ~[mongo-java-driver-3.4.2.jar:?]
at com.mongodb.DBObjectCodec.readDocument(DBObjectCodec.java:345) ~[mongo-java-driver-3.4.2.jar:?]
at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:138) ~[mongo-java-driver-3.4.2.jar:?]
at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:61) ~[mongo-java-driver-3.4.2.jar:?]
at com.mongodb.BasicDBObject.parse(BasicDBObject.java:75) ~[mongo-java-driver-3.4.2.jar:?]
at com.mongodb.BasicDBObject.parse(BasicDBObject.java:62) ~[mongo-java-driver-3.4.2.jar:?]
at org.hibernate.ogm.datastore.mongodb.query.parsing.nativequery.impl.MongoDBQueryDescriptorBuilder.parse(MongoDBQueryDescriptorBuilder.java:99) ~[hibernate-ogm-mongodb-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.datastore.mongodb.query.parsing.nativequery.impl.MongoDBQueryDescriptorBuilder.build(MongoDBQueryDescriptorBuilder.java:78) ~[hibernate-ogm-mongodb-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.datastore.mongodb.MongoDBDialect.parseNativeQuery(MongoDBDialect.java:862) ~[hibernate-ogm-mongodb-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.datastore.mongodb.MongoDBDialect.parseNativeQuery(MongoDBDialect.java:143) ~[hibernate-ogm-mongodb-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.dialect.impl.ForwardingGridDialect.parseNativeQuery(ForwardingGridDialect.java:200) ~[hibernate-ogm-core-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.query.impl.NativeNoSqlQueryInterpreter.getCustomQuery(NativeNoSqlQueryInterpreter.java:50) ~[hibernate-ogm-core-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.query.impl.NativeNoSqlQueryInterpreter.createQueryPlan(NativeNoSqlQueryInterpreter.java:45) ~[hibernate-ogm-core-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.engine.query.spi.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:210) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.ogm.hibernatecore.impl.OgmSessionImpl.list(OgmSessionImpl.java:301) ~[hibernate-ogm-core-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.ogm.query.impl.NoSQLQueryImpl.list(NoSQLQueryImpl.java:130) ~[hibernate-ogm-core-5.0.4.Final.jar:5.0.4.Final]
at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]


Top
 Profile  
 
 Post subject: Re: Error running the native query
PostPosted: Wed Feb 15, 2017 9:47 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 287
Hi,
which version of hibernate OGM are you using?

Aggregate operetaions are not supported at the moment unless you are using the SNAPSHOT or wait the next release.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.