Chosen shard key is supposedly not defined

I have reached step 3: Choose a shard key for the m103.products collection.

It looked like sku would be a good one, because it is a randomly generated integer, which should have good frequency and cardinality. I ran:

db.products.createIndex({“sku”: 1})

It seemed to go well, because I got output:

“raw” : {
“shard1/localhost:27001,localhost:27002,localhost:27003” : {
“createdCollectionAutomatically” : false,
“numIndexesBefore” : 1,
“numIndexesAfter” : 2,
“ok” : 1
“ok” : 1,
“operationTime” : Timestamp(1601486363, 11),
“$clusterTime” : {
“clusterTime” : Timestamp(1601486363, 11),
“signature” : {
“hash” : BinData(0,“i5gFchJ6zvE9wuGWlrJSnp3+F/I=”),
“keyId” : NumberLong(“6878319017065447453”)

However, when I then ran sh.shardCollection(“m103.products”, {sku})
I got the error message 2020-09-30T17:20:23.019+0000 E QUERY [js] ReferenceError: sku is not defined :

The same thing happens if I follow the above steps using _id, except that the output after createIndex says “all indexes already exist.” It still says it is undefined. What does it want me to define?

Go back at lesson Chapter 3: Sharding - Shard Keys, they have examples of the correct usage for sh.shardCollection(). You may also check the documentation at

So the only difference between what I had and what you had me review was that sh.shardCollection(“m103.products”, {sku}) should have been sh.shardCollection(“m103.products”, {“sku”: 1})

BTW, if I am asking for help with something, I am doing so after reading the docs. I already troubleshot a couple of problems with this lab that way before posting. Telling me to go back and reread what I just read is a waste of time, because if I am still asking, it is because I did not understand the docs you want me to reread. Documentation is written for people who already have a certain level of understanding of the platform.