O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving documents

To retrieve the list of documents, we use the find method. For example, run the following query to retrieve the full list of teams:

> db.teams.find(){ "_id" : ObjectId("5a5cf1419afc8af268b9bb21"), "code" : "PER", "name" : "Peru", "ranking" : 11, "captain" : "Paolo Guerreo", "Trainer" : "Ricardo Gareca", "confederation" : "Conmebol" }

As you can see, a new _id property has been added automatically. This property is known as the primary key of the JSON document. This is an autogenerated value, so you will have a different value when you run the command.

The teams' collection over time will have more than just a single team. So, how could we retrieve a single team from the collection? Do you remember the {} JSON object we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required