Lab - Changing Document Shape with $project

Getting - “Your $project stage doesn’t seem correct”

Not sure what the problem is -

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movies.aggregate(pipeline).pretty()
{
“title” : “Those Magnificent Men in Their Flying Machines or How I Flew from London to Paris in 25 hours 11 minutes”,
“rated” : “G”
}
{ “title” : “Red Sun”, “rated” : “PG” }
{ “title” : “Babies”, “rated” : “PG” }
{ “title” : “The Karate Kid”, “rated” : “PG” }
{ “title” : “Dragon Ball Z: Tree of Might”, “rated” : “PG” }
{ “title” : “Cars”, “rated” : “G” }
{ “title” : “Jack and the Beanstalk”, “rated” : “G” }
{ “title” : “The Transformers: The Movie”, “rated” : “PG” }
{ “title” : “Defending Your Life”, “rated” : “PG” }
{ “title” : “The Cat Returns”, “rated” : “G” }
{ “title” : “Hell in the Pacific”, “rated” : “G” }
{ “title” : “The Goodbye Girl”, “rated” : “PG” }
{ “title” : “Tora! Tora! Tora!”, “rated” : “G” }
{ “title” : “Local Hero”, “rated” : “PG” }
{ “title” : “Summer Wars”, “rated” : “PG” }
{ “title” : “The Secret World of Arrietty”, “rated” : “G” }
{ “title” : “Empire of the Sun”, “rated” : “PG” }
{ “title” : “Dreams”, “rated” : “PG” }
{ “title” : “Millennium Actress”, “rated” : “PG” }
{ “title” : “Whisper of the Heart”, “rated” : “G” }
Type “it” for more
MongoDB Enterprise Cluster0-shard-0:PRIMARY> it
{ “title” : “Life of Pi”, “rated” : “PG” }
{ “title” : “In the Shadow of the Moon”, “rated” : “PG” }
{ “title” : “Hachi: A Dog’s Tale”, “rated” : “G” }
MongoDB Enterprise Cluster0-shard-0:PRIMARY> validateLab2(pipeline)
Your $project stage doesn’t seem correct
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

The issue was resolved after combining all three project specifications into one $project.

1 Like