Chapter 4 : Advanced CRUD operators

video lecture 1
There was a search query written on the data explorer find field to find riders who rode for less than 70 sec and were not subscribers .so i ran this query
{“tripduration”:{"$lte":70},usertype:{"$ne":“subscriber”}}
in the find box for the sample_training.trips collection but instead of finding those who were not subscribers I found 10 random entries showing people who rode for less than 70 sec but were either subscribers or customers mostly subscribers can anyone help me to find what would be the right code to find the output

here is one sample result i got from that query
{"_id":{"$oid":“572bb8222b288919b68ad6bf”},“tripduration”:{"$numberInt":“68”},“start station id”:{"$numberInt":“3175”},“start station name”:“W 70 St & Amsterdam Ave”,“end station id”:{"$numberInt":“3175”},“end station name”:“W 70 St & Amsterdam Ave”,“bikeid”:{"$numberInt":“22964”},“usertype”:“Subscriber”,“birth year”:{"$numberInt":“1977”},“gender”:{"$numberInt":“1”},“start station location”:{“type”:“Point”,“coordinates”:[{"$numberDouble":"-73.98288594"},{"$numberDouble":“40.77748046”}]},“end station location”:{“type”:“Point”,“coordinates”:[{"$numberDouble":"-73.98288594"},{"$numberDouble":“40.77748046”}]},“start time”:{"$date":{"$numberLong":“1451660219000”}},“stop time”:{"$date":{"$numberLong":“1451660287000”}}}

Hi!

In the snippet you include “Subscriber” is capitalized. You could get a better match using

 {“tripduration”:{"$lte":70},usertype:{"$ne":/subscriber/i}}

Thanks for including all the relevant details.

hey there thanks for the reply, I corrected the CAP error but for some reason the error didn’t get solved i tried some experiments with individually running the $ne:“Subscriber” query and found out that the query was only picking up the first query i.e.-"$lte":70 but for some reason ignoring the second query i.e.-"$ne":“Subscriber”. ill try to find what went wrong but if you have any other idea please let me know… also this is my updated query which I will be working to find a solution for
{tripduration:{$lte:70}}{usertype:{"$ne":“Subscriber”}}

apparently it seems this query is supposed to be the right one
{“tripduration”:{"$lte":70},“usertype”:{"$ne":“Subscriber”}}
and this isn’t
{“tripduration”:{"$lte":70},“usertype”:{"$ne":“Subscriber”}}
at this point I cant wrap my head around why am i not able to enter the second query and get an output even though its same to the first query

After running this command:

{ 
"tripduration": { "$lte" : 70 },
"usertype": { "$ne": "Subscriber" } 
}

Which is listed on the video notes, Atlas finds one document.

I do notice though, that this return 10 documents instead:

{ 
"tripduration": { "$lte" : 70 }},
"usertype": { "$ne": "Subscriber" } 
}

But there is an extra curly brace after 70


I’d recommend to double check:

  • capitalization,
  • curly braces match
  • quotation (to be paired and the right type)

If you’re new to json, there is an online spell-checker, to check the validity of the document.

If I’m missing something probably someone else will help further.
Good luck :slight_smile:

1 Like

thanks for the help

Hi @Kris_vivek,

This looks like a bug to me. Let me file a ticket with the relevant team and we will get it resolved soon.

~ Shubham