Closed mervynzhang closed 9 months ago
nodejs
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";
const client = new MongoClient(url);
const myDB = client.db("myDB");
const myColl = myDB.collection("pizzaMenu");
const doc = { name: "Neapolitan pizza", shape: "round" };
const result = myColl.insertOne(doc);
console.log(
`A document was inserted with the _id: ${result.insertedId}`,
);
报错
14:45:10.037 [ScheduleService-6] ERROR org.lealone.plugins.mongo.server.MongoServerConnection - send error
org.lealone.common.exceptions.JdbcSQLException: Data conversion error converting "X'654345768110a6684f7ebc0d' (PIZZAMENU: _ROWID_ BIGINT)"; SQL statement:
-- row #2 ('Neapolitan pizza', 'round', X'654345768110a6684f7ebc0d') [22018-0]
at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:342) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.common.exceptions.DbException.get(DbException.java:173) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.common.exceptions.DbException.get(DbException.java:150) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.db.table.Column.convert(Column.java:154) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.sql.dml.MerSert$YieldableMerSert.createNewRow(MerSert.java:209) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.sql.dml.MerSert$YieldableMerSert.executeLoopUpdate0(MerSert.java:183) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.sql.dml.MerSert$YieldableMerSert.executeLoopUpdate(MerSert.java:176) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.sql.executor.YieldableLoopUpdateBase.executeInternal(YieldableLoopUpdateBase.java:31) ~[lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.sql.executor.YieldableBase.run(YieldableBase.java:115) [lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.db.session.ServerSession$YieldableCommand.run(ServerSession.java:1306) [lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.server.Scheduler.executeNextStatement(Scheduler.java:308) [lealone-6.0.0-SNAPSHOT.jar:?]
at org.lealone.server.Scheduler.run(Scheduler.java:134) [lealone-6.0.0-SNAPSHOT.jar:?]
MongoDB 插件还在逐步完善,如果报错就是还没有实现的功能。
第一个错误是数组转成字符串出错了,第二个错误是 _id 字段目前只支持数字,nodejs 自动生成的 _id 是二进制。这两个后续就会解决。
报错