What causes this Err message : BadValue unknown top level operator

1,109 views
Skip to first unread message

Lady Redhead

unread,
Nov 4, 2015, 6:07:03 AM11/4/15
to mongodb-dev
Got this error message and I don't know what this tells me about my query, where do i have to look
for my mistake ?

( It was purpose that I don't posted the query, I dont want to get told, this is your mistake, I want to learn to find it on my own )

Andrew Morrow

unread,
Nov 4, 2015, 3:59:09 PM11/4/15
to mongodb-dev

Hi - 

The error message that you are getting is telling you that you have written an incorrect query. You can see where the error message was generated by the server here: https://github.com/mongodb/mongo/blob/826bdb4c161faf9ac28592cb5b70554251a2dc86/src/mongo/db/matcher/expression_parser.cpp#L356

I found this by running grep over the sources:

> grep -nr 'unknown top level operator' src/mongo
src/mongo/db/matcher/expression_parser.cpp:356:                                   << "unknown top level operator: " << e.fieldName())};

By reading the MatchExpressionParser::_parse function (starting at https://github.com/mongodb/mongo/blob/826bdb4c161faf9ac28592cb5b70554251a2dc86/src/mongo/db/matcher/expression_parser.cpp#L291) you should be able to compare your query and the code to figure out what you have written that the expression parser does not understand.

Alternatively, you could review the query documentation (https://docs.mongodb.org/manual/tutorial/query-documents) and ensure that your query only uses operators as described.

In the future, please provide the version of MongoDB that you are using when asking questions, as it will help us provide an accurate response.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages