Trying to understand MongoDB,
this query does not insert anything into 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()
>
Thats because of typo:
lenght -> lengthAnd maybe it’s required to explicitly create collection like
db.createCollection('people');