java.lang.IllegalArgumentException: Invalid reference '_id.eventID'!

Spring JIRA | Christine Chan | 3 years ago
  1. 0

    The following query in mongo is as such: {code} db.auditErrorEvents.aggregate( {"$group":{_id:{ "eventID" : "$event.eventID" , "appID" : "$event.appID" , "eventUID" : "$event.eventUID" , "osPlatform" : "$event.osPlatform" , "deviceType" : "$event.deviceType"}}}, {"$group":{_id:{ "eventID" : "$_id.eventID" , "appID" : "$_id.appID" , "osPlatform" : "$_id.osPlatform" , "deviceType" : "$_id.deviceType"}, "count" : { "$sum" : 1}}} ); {code} Basically this is a distinct count of a field eventUID with grouping eventID, appID, osPlatform, deviceType. The {{MongoTemplate}} does not allow me to refer to the first grouping. {code} template.aggregate(newAggregation( group(from(field("eventID", "event.eventID"), field("appID", "event.appID"), field("eventUID", "event.eventUID"), field("osPlatform", "event.osPlatform"), field("deviceType", "event.deviceType"))), group(from(field("eventID", "_id.eventID"), field("appID", "_id.appID"), field("osPlatform", "_id.osPlatform"), field("deviceType"))).count().as("count")), collectionName(), GroupedCount.class); {code} {noformat} java.lang.IllegalArgumentException: Invalid reference '_id.eventID'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78) at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62) at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:300) {noformat}

    Spring JIRA | 3 years ago | Christine Chan
    java.lang.IllegalArgumentException: Invalid reference '_id.eventID'!
  2. 0

    The following query in mongo is as such: {code} db.auditErrorEvents.aggregate( {"$group":{_id:{ "eventID" : "$event.eventID" , "appID" : "$event.appID" , "eventUID" : "$event.eventUID" , "osPlatform" : "$event.osPlatform" , "deviceType" : "$event.deviceType"}}}, {"$group":{_id:{ "eventID" : "$_id.eventID" , "appID" : "$_id.appID" , "osPlatform" : "$_id.osPlatform" , "deviceType" : "$_id.deviceType"}, "count" : { "$sum" : 1}}} ); {code} Basically this is a distinct count of a field eventUID with grouping eventID, appID, osPlatform, deviceType. The {{MongoTemplate}} does not allow me to refer to the first grouping. {code} template.aggregate(newAggregation( group(from(field("eventID", "event.eventID"), field("appID", "event.appID"), field("eventUID", "event.eventUID"), field("osPlatform", "event.osPlatform"), field("deviceType", "event.deviceType"))), group(from(field("eventID", "_id.eventID"), field("appID", "_id.appID"), field("osPlatform", "_id.osPlatform"), field("deviceType"))).count().as("count")), collectionName(), GroupedCount.class); {code} {noformat} java.lang.IllegalArgumentException: Invalid reference '_id.eventID'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78) at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62) at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:300) {noformat}

    Spring JIRA | 3 years ago | Christine Chan
    java.lang.IllegalArgumentException: Invalid reference '_id.eventID'!
  3. 0
    Invalid http request, probably hacking with manually crafted requests.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    Some bots are sending malformed HTTP requests to your site. Try to find their IP addresses in the access logs and ask them to fix the bots or blacklist them.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Invalid reference '_id.eventID'!

      at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference()
    2. Spring Data MongoDB - Core
      GroupOperation.toDBObject
      1. org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78)
      2. org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62)
      3. org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:300)
      3 frames