MongoDB string query comparison

MongoDB lexicographically sorts strings in UTF-8 and can use $gt ($greater than, greater than) and $lt ($less than, less than) for string queries

List all documents whose name field begins with D:

>db.people.find( { name: { $lt:"D" } } );


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324879458&siteId=291194637