试图了解MongoDB,
此查询不会在db:
中插入任何内容> names = ['Serg', 'Bob', 'Sean', 'Sophia'];
[ "Serg", "Bob", "Sean", "Sophia" ]
> for (i=0; i<names.lenght; i++) db.people.insert({ name: names[i], age: Math.round(Math.random()*60) });
> db.people.find()
>
答案 0 :(得分:1)
这是因为拼写错误:lenght -> length
也许需要明确创建像db.createCollection('people');