用mongodb创建集合之后死活不能插入数据

用mongodb创建集合之后死活不能插入数据

> db.createCollection('version');
{ "ok" : 1 }
> db.version.drop();
2020-01-14T15:35:27.868+0800 E QUERY    [thread1] TypeError: db.version.drop is not a function :
@(shell):1:1
> db.version.find();
2020-01-14T15:35:34.980+0800 E QUERY    [thread1] TypeError: db.version.find is not a function :
@(shell):1:1
> db.version.insert()
2020-01-14T15:35:46.161+0800 E QUERY    [thread1] TypeError: db.version.insert is not a function :
@(shell):1:1

问题出在哪里?
答:不要用"version"这个名字,换个集合名字就好了。

原文地址:https://www.cnblogs.com/bugutian/p/12192332.html