How to use "value%" with like keyword in mangodb -


i can execute below query in mangodb

mysql:

select * users user_id "bc%; 

mangodb:

db.users.find( { user_id: /^bc/ } ) 

the above query working. below query not working please me give suggestion.

mysql:

select * users user_id "%bc"; 

mangodb:

db.users.find( { user_id: /bc^/ } ); 

in regex ^ character labels start of subject. putting on right hand side therefore not meaningful.

instead, "end of string" analogue ^ $:

db.users.find( { user_id: /bc$/ } ); 

this translates to: find users last 2 characters of user_id attribute 'bc'.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -