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

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -