java.lang.IllegalArgumentException: Update document keys must start with $: _id

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,

Use replaceOne instead of updateOne

Solutions on the web

via Google Groups by Vivek YS, 11 months ago
Update document keys must start with $: _id
via Google Groups by miki haiat, 11 months ago
via Stack Overflow by Unknown author, 2 years ago
Update document keys must start with $: _id
java.lang.IllegalArgumentException: Update document keys must start with $: _id
at com.mongodb.DBCollectionImpl$Run.executeUpdates(DBCollectionImpl.java:769)
at com.mongodb.DBCollectionImpl$Run.execute(DBCollectionImpl.java:734)
at com.mongodb.DBCollectionImpl.executeBulkWriteOperation(DBCollectionImpl.java:149)
at com.mongodb.DBCollection.executeBulkWriteOperation(DBCollection.java:1737)
at com.mongodb.DBCollection.executeBulkWriteOperation(DBCollection.java:1733)
at com.mongodb.BulkWriteOperation.execute(BulkWriteOperation.java:93)
at com.mongodb.casbah.BulkWriteOperation$$anonfun$1.apply(BulkWriteOperation.scala:71)
at scala.util.Try$.apply(Try.scala:161)
at com.mongodb.casbah.BulkWriteOperation.execute(BulkWriteOperation.scala:71)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.