I tried following query but it's failings. I don't understand why?

I am at lecture 4 comparison operators section

I tried following commands

{ “$and”: [ { “pop”: { “$gt”: 5000 }}, { “pop”: { “$lt”: 1,000,000 }} ]}

{ “pop”: { “$gt”: 5000, “$lt”: 1,000,000 }}

Both of them are failing with “uncaught exception: SyntaxError: missing : after property id” in my mongo shell not sure why?

Hello @jchakrad, welcome back to the MongoDB Community forum!

A reason is using the comma punctuation mark within a number:


1 Like

Hi @jchakrad, welcome back to the community.
Thanks, @Prasad_Saya for your insights.
In case @jchakrad if you still prefer to have some kind of separation between the digits, you can try the following:


and it will still be treated as 1 Million.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

1 Like

@Prasad_Saya Thank you.