Subject: [mongodb-user] Re: mongo hadoop 1.5.2 version to

java.lang.IllegalArgumentException: Invalid BSON field name $set Doesn’t it support set operation?

Hi David,

It’s been a while since you posted your question, have you found the answer yet ?

Yes, it should still support $set operation. You should check the content of your variable setObj.
For example, below should work with mongo-hadoop v2.0.2, Spark v2.0, MongoDB Java driver v3.4.x

MongoUpdateWritable test = new MongoUpdateWritable(new BasicDBObject("_id", 123), 
                            new BasicDBObject("$set", new BasicDBObject("foo", "bar")), 
                            true, false, false

And another question I found that the field name can’t contain “.”, which is inherited document use.

See also MongoDB dot-notation 

I use Mongo Hadoop to store data in Spark directly.

If you’re utilising mongo-hadoop to read/write to Spark, I would recommend to check out MongoDB Spark Connector (Java) instead. See also Spark Java Guide: Write to MongoDB


You received this message because you are subsc...

ribed to the Google Groups "mongodb-user"
For other MongoDB technical support options, see:
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at
To view this discussion on the web visit
For more options, visit

Programming list archiving by: Enterprise Git Hosting