I am not getting same explain as shown

In chapter 2 lesson MultiKey Index , there is an example of inserting products collection. I have done identical in my setup , however my explain plan is not taking the Index scan, its going for Collection Scan.
Following is the excerpt .

use m201
switched to db m201
db.products.insert({
… productName: “MongoDB Short Sleeve T-Shirt”,
… categories: [“T-Shirts”, “Clothing”, “Apparel”],
… stock: { size: “L”, color: “green”, quantity: 100}
… });
WriteResult({ “nInserted” : 1 })
db.products.find().pretty()
{
“_id” : ObjectId(“5d10b9c1ef48842017798987”),
“productName” : “MongoDB Short Sleeve T-Shirt”,
“categories” : [
“T-Shirts”,
“Clothing”,
“Apparel”
],
“stock” : {
“size” : “L”,
“color” : “green”,
“quantity” : 100
}
}
db.products.createIndex({“stocks.quantity”:1})
{
“createdCollectionAutomatically” : false,
“numIndexesBefore” : 1,
“numIndexesAfter” : 2,
“ok” : 1
}
var exp =db.products.explain()
exp.find({stock.quantity:100})
2019-06-24T17:27:05.574+0530 E QUERY [js] SyntaxError: missing : after property id @(shell
exp.find({“stock.quantity”: 100})
{
“queryPlanner” : {
“plannerVersion” : 1,
“namespace” : “m201.products”,
“indexFilterSet” : false,
“parsedQuery” : {
“stock.quantity” : {
“$eq” : 100
}
},
“winningPlan” : {
“stage” : “COLLSCAN”,
“filter” : {
“stock.quantity” : {
“$eq” : 100
}
},
“direction” : “forward”
},
“rejectedPlans” :
},
“serverInfo” : {
“host” : “Jatin_PC”,
“port” : 27001,
“version” : “4.0.9”,
“gitVersion” : “fc525e2d9b0e4bceff5c2201457e564362909765”
},
“ok” : 1
}

You have a typo error in the name of the index. The field is stock.quantity and you created the index on stocks.quantity.

Hi Steeve,
In that case , why the index creation was successful. Should it not fail rather as the collection did not had the key present.

No. Mongo is schema-less. More information at https://docs.mongodb.com/manual/indexes/