make data by c-driver
bson_append_array_begin( &bson, "array", -1, &bson_array );
bson_append_int32( &bson_array, "", -1, 1 );
bson_append_int32( &bson_array, "", -1, 2 );
bson_append_array_end( &bson, &bson_array );
view
mongo cli work
csharp-driver work
but java-driver got exception
java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: []
at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:165)
at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:156)
at org.bson.types.BasicBSONList.put(BasicBSONList.java:70)
at org.bson.BasicBSONCallback._put(BasicBSONCallback.java:184)
at org.bson.BasicBSONCallback.gotLong(BasicBSONCallback.java:132)
at org.bson.BasicBSONDecoder.decodeElement(BasicBSONDecoder.java:222)
at org.bson.BasicBSONDecoder.decodeElement(BasicBSONDecoder.java:271)
at org.bson.BasicBSONDecoder._decode(BasicBSONDecoder.java:154)
at org.bson.BasicBSONDecoder.decode(BasicBSONDecoder.java:132)
at com.mongodb.DefaultDBDecoder.decode(DefaultDBDecoder.java:62)
at com.mongodb.Response.<init>(Response.java:85)
at com.mongodb.DBPort$1.execute(DBPort.java:141)
at com.mongodb.DBPort$1.execute(DBPort.java:135)
at com.mongodb.DBPort.doOperation(DBPort.java:164)
at com.mongodb.DBPort.call(DBPort.java:135)
at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:292)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:271)
at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66)
at com.mongodb.DBCursor._check(DBCursor.java:458)
at com.mongodb.DBCursor._hasNext(DBCursor.java:546)
at com.mongodb.DBCursor.hasNext(DBCursor.java:571)
at com.edgytech.umongo.CollectionPanel$1.doRun(CollectionPanel.java:259)
at com.edgytech.umongo.DbJob$1.doInBackground(DbJob.java:86)
at javax.swing.SwingWorker$1.call(SwingWorker.java:277)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at javax.swing.SwingWorker.run(SwingWorker.java:316)
at com.edgytech.swingfast.ScalableThreadPool$ScalableThreadpoolWorker.run(ScalableThreadPool.java:48)
at java.lang.Thread.run(Thread.java:662)
- is related to
-
CDRIVER-504 Convenient API to create BSON arrays
- Closed
-
SERVER-16814 Validate array keys in BSON documents
- Backlog