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

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -