javascript - Node.js MongoDB .findOne returns best match when querying a String -


if create document in mongodb using create method.

ua.create({mystringfield: 'mystringdata'}, function(err, myua){   callback(err,myua); }); 

later want search new string in database , use method.

ua.findone({mystringfield: 'mystringdatanew'}, function(err, myua){   callback(err,myua); }); 

notice set original mystringfield data 'mystringdata' , searching 'mystringdatanew'. findone() method returns document containing 'mystringdata' result of query.

how query exact matches strings in mongodb?

many help.

i'm pretty getting confused. findone call exact, case-sensitive match. partial matches or case-insensitive need use regexp instance not basic string. suggestion make simple test case separate app, , suspicion db not behaving way think is.


Comments

Popular posts from this blog

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -