com.mongodb.util.JSONParseException: { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^

MuleSoft JIRA | Ryan Meyer | 4 years ago
  1. 0

    In Mule Studio (using Mule 3.3.0), my flow works correctly when trying to update objects in Mongo using the following line in the flow: <mongo:update-objects config-ref="Mongo_Vehicle_Tags" collection="article_vehicle_tag" query-ref="#[string: { '_id' : '#[json:_id]' } ]" element-ref="#[string: { '_id' : '#[json:_id]', $addToSet : { 'tags' : { $each : #[json:tags] } } } ]" multi="false" upsert="true" doc:name="Mongo DB"/> However, when deployed to a stand alone Mule server (again using 3.3.0) on a Linux machine, I get this error: INFO 2012-09-07 18:50:50,185 [[adamcontent].article_vehicle_tags.stage1.02] org.mule.api.processor.LoggerMessageProcessor: [Writing vehicle tags from ADAM Articles] Payload: {"_id":"70005_best_and_worst","tags":["'SEMA'","'Burnout'","'Project Build'","'47'","'new_launch'","'new_launches_again'"]} ERROR 2012-09-07 18:50:50,341 [[adamcontent].article_vehicle_tags.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Failed to transform from "java.lang.String" to "com.mongodb.DBObject" Code : MULE_ERROR-65110 -------------------------------------------------------------------------------- Exception stack is: 1. { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^ (com.mongodb.util.JSONParseException) com.mongodb.util.JSONParser:467 (null) 2. Failed to transform from "java.lang.String" to "com.mongodb.DBObject" (org.mule.api.transformer.TransformerException) org.mule.module.mongo.transformers.JsonToDbobjectTransformer:42 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html) -------------------------------------------------------------------------------- Root Exception stack trace: com.mongodb.util.JSONParseException: { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^ at com.mongodb.util.JSONParser.parseString(JSON.java:467) at com.mongodb.util.JSONParser.parseObject(JSON.java:350) at com.mongodb.util.JSONParser.parse(JSON.java:316) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** My best guess is that the Mongo connector is trying to verify that the element-ref JSON is correct JSON using the Mongo Java driver. When the parse sees the "$addToSet" command in the JSON it complains that this is not valid JSON. $addToSet is a valid command for Mongo, so it should work.

    MuleSoft JIRA | 4 years ago | Ryan Meyer
    com.mongodb.util.JSONParseException: { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^
  2. 0

    In Mule Studio (using Mule 3.3.0), my flow works correctly when trying to update objects in Mongo using the following line in the flow: <mongo:update-objects config-ref="Mongo_Vehicle_Tags" collection="article_vehicle_tag" query-ref="#[string: { '_id' : '#[json:_id]' } ]" element-ref="#[string: { '_id' : '#[json:_id]', $addToSet : { 'tags' : { $each : #[json:tags] } } } ]" multi="false" upsert="true" doc:name="Mongo DB"/> However, when deployed to a stand alone Mule server (again using 3.3.0) on a Linux machine, I get this error: INFO 2012-09-07 18:50:50,185 [[adamcontent].article_vehicle_tags.stage1.02] org.mule.api.processor.LoggerMessageProcessor: [Writing vehicle tags from ADAM Articles] Payload: {"_id":"70005_best_and_worst","tags":["'SEMA'","'Burnout'","'Project Build'","'47'","'new_launch'","'new_launches_again'"]} ERROR 2012-09-07 18:50:50,341 [[adamcontent].article_vehicle_tags.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Failed to transform from "java.lang.String" to "com.mongodb.DBObject" Code : MULE_ERROR-65110 -------------------------------------------------------------------------------- Exception stack is: 1. { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^ (com.mongodb.util.JSONParseException) com.mongodb.util.JSONParser:467 (null) 2. Failed to transform from "java.lang.String" to "com.mongodb.DBObject" (org.mule.api.transformer.TransformerException) org.mule.module.mongo.transformers.JsonToDbobjectTransformer:42 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html) -------------------------------------------------------------------------------- Root Exception stack trace: com.mongodb.util.JSONParseException: { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^ at com.mongodb.util.JSONParser.parseString(JSON.java:467) at com.mongodb.util.JSONParser.parseObject(JSON.java:350) at com.mongodb.util.JSONParser.parse(JSON.java:316) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** My best guess is that the Mongo connector is trying to verify that the element-ref JSON is correct JSON using the Mongo Java driver. When the parse sees the "$addToSet" command in the JSON it complains that this is not valid JSON. $addToSet is a valid command for Mongo, so it should work.

    MuleSoft JIRA | 4 years ago | Ryan Meyer
    com.mongodb.util.JSONParseException: { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^
  3. 0

    Spring Data Mongo Custom Repository Query with ObjectID

    Stack Overflow | 1 year ago | Whales
    com.mongodb.util.JSONParseException: { 'items': { $elemMatch: { 'refund.$id' : ObjectId("_param_0") } } } ^
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Problem with finding and updating by objectId

    Google Groups | 4 years ago | siriss
    java.lang.IllegalArgumentException: Unable to create Update query {_id: #}, please check cause exception. Beware 'update(String query, String modifier)' has been replaced by 'update(String query, Object... parameters)' in v0.2. To specify modifier please use: 'update(String query).with(String modifier)'
  6. 0

    Hibernate Community • View topic - Exception in sort query

    hibernate.org | 3 months ago
    com.mongodb.util.JSONParseException: db.UserFactualContent.aggregate([{ '$match': {'$or': [ {'NAME':{'$regex':'(?i)Bangalore'}}, {'DESCRIPTION':{'$regex':'(?i)Bangalore'}}],'$and':[{'FLAG':'public'}] } },{ '$unwind' : '$clicks' },{ '$group' : {'_id' : '$_id' ,'clicks' : {$push:'$clicks'} ,'token' : { '$push': '$TOKEN' } } }]) ^

    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. com.mongodb.util.JSONParseException

      { '_id' : '70005_best_and_worst', $addToSet : { 'tags' : { $each : ['SEMA', 'Burnout', 'Project Build', '47', 'new_launch', 'new_launches_again'] } } } ^

      at com.mongodb.util.JSONParser.parseString()
    2. MongoDB Java Driver
      JSONParser.parse
      1. com.mongodb.util.JSONParser.parseString(JSON.java:467)
      2. com.mongodb.util.JSONParser.parseObject(JSON.java:350)
      3. com.mongodb.util.JSONParser.parse(JSON.java:316)
      3 frames