[SERVER-24548] Query with gte instead of $gte is not reporting a syntax error Created: 14/Jun/16  Updated: 14/Jul/16  Resolved: 14/Jun/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.0.12
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Abhishek Alney Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

use pcat db

run the below query

> db.pd.find({$and:[

{name:"AC3 Case Red"}

,{price:{gte:12}}]})
>

Participants:

 Description   

hi,

I am using Mongo 3.0.12 on Linux 4.2.3-300.fc23.x86_64. While running the below query , mongo shell did not report a syntax error. Where in the $ sign is missing in the query.

> db.pd.find({$and:[

{name:"AC3 Case Red"}

,{price:{gte:12}}]})
>



 Comments   
Comment by Ramon Fernandez Marina [ 14/Jun/16 ]

abhishek.alney, this is expected behavior, as gte is a valid field name. For example, the following document would be returned by your query:

{_id : 1, name : "AC3 Case Red", price : { gte : 12 }}

Regards,
Ramón.

Generated at Thu Feb 08 04:06:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.