java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: [_id][info]


Samebug tips2

This happened when I tried to insert an empty list of elements to a MongoDB collection.


1 year ago

You try to insert an empty list into MongoDB before 3.5.0 .

Check that the inserted list is not empty or upgrade your server.


,
via JIRA by Stephan Schroevers

Solutions on the web17

Solution icon of googlegroups
BasicBSONList can only work with numeric keys, not: [_id][info]

Solution icon of stackoverflow
BasicBSONList can only work with numeric keys, not: [_id] EDIT Full stack trace [info] java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of stackoverflow
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of stackoverflow
via Stack Overflow by Mike Dynamite
, 1 year ago
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of googlegroups
via Google Groups by Robbie Cheng, 1 year ago
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of googlegroups
via Google Groups by Robbie Cheng, 1 year ago
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of stackoverflow
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of stackoverflow
BasicBSONList can only work with numeric keys, not: [_id]

Solution icon of googlegroups
BasicBSONList can only work with numeric keys, not: [className]

Solution icon of stackoverflow
BasicBSONList can only work with numeric keys, not: [elementData]

Stack trace

java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: [_id][info]
	at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:161)[info]
	at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:152)[info]
	at org.bson.types.BasicBSONList.get(BasicBSONList.java:104)[info]
	at com.mongodb.DBCollection.apply(DBCollection.java:767)[info]
	at com.mongodb.DBCollection.apply(DBCollection.java:756)[info]
	at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:220)[info]
	at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)[info]
	at com.mongodb.DBCollection.insert(DBCollection.java:76)[info]
	at com.mongodb.casbah.MongoCollectionBase$class.insert(MongoCollection.scala:508)[info]
	at com.mongodb.casbah.MongoCollection.insert(MongoCollection.scala:866)

Write tip

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

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 2 years ago
15 times, 6 hours ago
4 times, 1 day ago
Once, 1 week ago
3 times, 1 week ago
6 more bugmates