Selecting only one field from a record in atlas

In the sample_training.trips collection a person with birth year 1961 took a trip that started at “Howard St & Centre St”. What was the end station name for that trip?

Copy and paste your answer from the Atlas UI to the response text box. The station name should be in a single set double quotes, exactly as it is in the Data Explorer.

Issue: I have queried to get the one record out of many,
{“birth year”:1961, “start station name”:“Howard St & Centre St”}

But, was unable to get only one field (end station name) in atlas. I have tried using projection as well as below, where i’m going wrong.
{“birth year”:1961, “start station name”:“Howard St & Centre St”},{end station name}


Thanks!!

Hi @Lakshman_Jaddu,

Welcome to the MongoDB Community Forum,

I think you misunderstood it. No issue, let me clarify it for you.

Here, you don’t have to write a query to get only one field in the Atlas UI, you have to just copy the field value of the end station name from the document you are getting in the Atlas UI as query result and then paste it into the Answer Box and that’s it.

FYI: To get the only one field in the query result, you have to use the aggregation feature of MongoDB to write down your query. For that, you can refer to the Aggregation tab in the Atlas UI to perform the operations.

Meanwhile, you can learn MongoDB Aggregation Framework from the MongoDB University.

If you have any more questions, let us know.

All the Best,
Kushagra

1 Like