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]
|