java.lang.IllegalArgumentException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Use replaceOne instead of updateOne


rp

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Bulk upsert
    via by Vivek YS,
  • Best way to create bulk upsert
    via by miki haiat,
    • 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 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)
    No Bugmate found.