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
Post a Comment