How to escape a single quote in a string?
Answered
I have a string in my database that has a ' character in the string. I'm searching for the record with this string in a field - and I can't escape the single quote character.
select *
from messages
where type='new record'
and payload.language='fr-FR'
and payload.normalization='aller au boulevard gouin ouest et l' avenue le mesurier montréal'
How can i escape the ' in l' avenue?
The current build(4.5.2) does not provide such functionality, please download 4.5.3 and give it a try.
Win: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.exe
Mac: https://nosqlbooster.com/s3/download/releasesv4/nosqlbooster4mongo-4.5.3.dmg
Linux: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.AppImage
In the 4.5.3, you can use literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal") to escape single quote char.
select *
from messages
where type='new record'
and payload.language='fr-FR'
and payload.normalization=literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal")
The current build(4.5.2) does not provide such functionality, please download 4.5.3 and give it a try.
Win: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.exe
Mac: https://nosqlbooster.com/s3/download/releasesv4/nosqlbooster4mongo-4.5.3.dmg
Linux: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.AppImage
In the 4.5.3, you can use literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal") to escape single quote char.
select *
from messages
where type='new record'
and payload.language='fr-FR'
and payload.normalization=literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal")
Thanks for the quick response! Unfortunately the literal doesn't seem to be translated correctly. Here is the aggregation that it generated using my example (look at the $project the $aller - although it did interpret the ' correctly)
Thanks for the quick response! Unfortunately the literal doesn't seem to be translated correctly. Here is the aggregation that it generated using my example (look at the $project the $aller - although it did interpret the ' correctly)
Which platform are you using? Win, Mac or Ubuntu?
What's your MongoDB Server Version? 3.2, 3.4 or 3.6?
And, Could you give me your complete SQL statement? Is it a SQL statement like the following?
select *
from messages
where type='new record'
and payload.language='fr-FR'
and payload.normalization=literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal")
Which platform are you using? Win, Mac or Ubuntu?
What's your MongoDB Server Version? 3.2, 3.4 or 3.6?
And, Could you give me your complete SQL statement? Is it a SQL statement like the following?
select *
from messages
where type='new record'
and payload.language='fr-FR'
and payload.normalization=literal("aller au boulevard gouin ouest et l' avenue le mesurier montréal")
Replies have been locked on this page!