uncaught exception: SyntaxError: expected target, got identifier : @(shell):1:11

mongodb 插入数据报错

> db.iot-new.insert({"name":"haha"})
uncaught exception: SyntaxError: expected target, got identifier :
@(shell):1:11
>

 

 

 

 

数据库名有特殊符号:-

需要特殊处理

> use iot-new
switched to db iot-new
> db
iot-new
> db.getCollection("iot-new").insert({"name":"haha"})
WriteResult({ "nInserted" : 1 })

 

 

posted @ 2022-08-24 09:02  leihongnu  阅读(62)  评论(0)    收藏  举报