Geospatil Queries

Hi,

In Lesson 1.6 the Geospatial Query, the number of documents matching the query is 99 and Compass retrieved exactly the 99 documents matching the query (100%).

For previous lessons, I didn’t notice that happening. Could someone elaborate on this?

I am sorry I could not understand the question. Please elaborate on this so that I can help.

Kanika

For example, if I try to filter data using {genre: ‘Documentary’} from the video.movies namespace what I get is:

‘Query returned 71085 documents. This report is based on a sample of 1000 documents (1.41%).’

Although, for the Geospatial Query I metioned before it returns 100%. So, what I don’t understand is what this percentage is trying to represent…

Thanks, @Kanika!

Hello Kanika,

Can you help me to know, how can i find a particular location by name only instead of wasting time in drag and drag to find a place which is mentioned in the lab exercise.

Cheers

Hi Yago_83503,

the answer is quite simple.

In the example ‘Query returned 71085 documents. This report is based on a sample of 1000 documents (1.41%).', you obtain 1.41% because 1000 (the size of the sample) is the 1.41 percent of 71085.

In the second example: ‘the number of documents matching the query is 99 and Compass retrieved exactly the 99 documents matching the query (100%).’, you obtain 100% because the number of documents matching the query is less than 1000 (the sampleSize is set to 1000 documents.), so the query returned all documents matching that filter and not only a sample.

I trust I make myself clear.
For a more detailed explanation about sampling: https://docs.mongodb.com/compass/current/faq/#what-is-sampling-and-why-is-it-used

Cheers
Giovanni

1 Like

Hi Yago_83503,

Interesting question. I am sorry for the delayed response.

In Compass, we show schema for maximum 1000 documents which are chosen randomly. The % in the bracket describes the % composition from total documents given for anaylze.

Consider this:

So, maximum documents that can be taken in sample is 1000 documents i.e. ( 1000/71085 ) * 100 = 1.41%.

But when you filter documents and you have total 99 documents which is less than 1000, so the Schema takes all the documents to analyze. Thats why it shows 100% i.e (99/99) * 100 = 100%.

Kanika

1 Like

Hi Jitendra_06416,

Sorry that you find it wasting your time.

I think if you Google the coordinates using name of location, it will be easy for you. Just type the coordinates in the filter query section using appropriate query operators.

Kanika

1 Like

Thank you @Kanika and @Giovanni_83624 for the help!

1 Like