MongoDB query
Several methods of MongoDB query
Query.All(“name”, “a”, “b”);//Match the array through multiple elements
Query.And(Query.EQ(“name”, “a”), Query.EQ(“title”, “t”));//Satisfy multiple conditions at the same time
Query.EQ(“name”, “a”);//equal to
Query.Exists(“type”, true);//Determine whether the key value exists
Query.GT(“value”, 2);//Greater than>
Query.GTE(“value”, 3);//Greater than or equal to>=
Query.In(“name”, “a”, “b”);//Include all specified values, you can specify different types of conditions and values
Query.LT(“value”, 9);//less than <
Query.LTE(“value”, 8);//Less than or equal to <=
Query.Mod(“value”, 3, 1);//divide the query value by the first given value, and return the result if the remainder is equal to the second given value
Query.NE(“name”, “c”);//Not equal
Query.Nor(Array);//Does not include the values in the array
Query.Not(“name”);//Element conditional statement
Query.NotIn(“name”, “a”, 2);//Return documents that do not match all the conditions in the array
Query.Or(Query.EQ(“name”, “a”), Query.EQ(“title”, “t”));//Meet one of the conditions
Query.Size(“name”, 2);//The length of the given key
Query.Type(“_id”, BsonType.ObjectId );//The type of the given key
Query.Where(BsonJavaScript);//Execute JavaScript
Query.Matches(“Title”,str);//Fuzzy query is equivalent to like in sql — str can contain regular expressions
View real-time Mongodb query commands
When you need to monitor and mongodb query output to a text, you can use the command:
c: \ MongoDB \ bin \ the mongod -dbpath c: \ MongoDB \ -v -logpath the Data c: \ mongoDB \ log \ mlog.txt
then you can Use tools like baretail to analyze the query.
Thanks for reading this post, if you like, followme up here to get latest update on this.