admin管理员组

文章数量:1130349

在mongodb数据库操作中,如果使用常规的方法获取带数字等非正常名称集合,会获取失败,并会返回identifier starts immediately after numeric literal 错误。

> db.userInfo-1.drop()

2018-06-24T20:26:34.585+0800 E QUERY    [thread1] SyntaxError: identifier starts immediately after numeric literal @(shell):1:12



可以使用getCollection()方法获取非正常名称的集合以进行下一步操作。

> db.getCollection("userInfo-1").drop()
true

在mongodb数据库操作中,如果使用常规的方法获取带数字等非正常名称集合,会获取失败,并会返回identifier starts immediately after numeric literal 错误。

> db.userInfo-1.drop()

2018-06-24T20:26:34.585+0800 E QUERY    [thread1] SyntaxError: identifier starts immediately after numeric literal @(shell):1:12



可以使用getCollection()方法获取非正常名称的集合以进行下一步操作。

> db.getCollection("userInfo-1").drop()
true

本文标签: 非正常名称数字mongodb