Query by map key that contains a "." [duplicate] - google-cloud-firestore

This question already has an answer here:
Firestore Query Properties with special characters
(1 answer)
Closed 2 years ago.
With the following document, how would you escape the where query ?
/posts/abc
users: [map]
abc.def: 4
firestore().collection('posts').where('users.abc.def' , '>' , 0)
Is there a way to escape the . ?
Thanks

As #kmoser mentioned in the comment above, the solution is to use FieldPath
firestore().collection('posts').where(new firestore.FieldPath('users', 'abc.def'), '>' , 0)

Related

Why does wrapping output in quote create extra quote after? [duplicate]

This question already has answers here:
.* matches 2 times
(2 answers)
Why do regex engines allow / automatically attempt matching at the end of the input string?
(6 answers)
Closed 6 months ago.
I want to ls -name a folder and wrap the result between the quotes`. However the result make an extra quote after.
> (ls -name) -replace '(.*)', '"$1"'
"apple"""
"orange"""
"dog"""
"cat"""
Why is that?

I Can't define string in dart with $ in it [duplicate]

This question already has answers here:
How do you print a dollar sign $ in Dart
(2 answers)
Closed 2 years ago.
I want to use this as String in Dart.
String s = 'reservoir$lbc_release'
Getting error due to $. How do I solve this?
Just use escape sequence
print('Hello \$');
Please use '\' in front of '$'
String s = 'reservoir\$lbc_release'

Difference between SUBSTR and SUBSTRING [duplicate]

This question already has an answer here:
Difference between substring in Postgresql
(1 answer)
Closed 2 years ago.
I've noticed that Postgres allows me to use SUBSTR or SUBSTRING. Both produce the same results. Is there a difference in the two?
There are some differences at least in syntax:
substring(string [from int] [for int])
substring(string from pattern)
substring(string from pattern for escape)
and
substr(string, from [, count])
See details in https://www.postgresql.org/docs/12/functions-string.html

Fuzzy searching with MongoDB, why does /1.0/ match 100.0? [duplicate]

This question already has an answer here:
Why do escape characters in regex mismatch?
(1 answer)
Closed 3 years ago.
https://imgsa.baidu.com/forum/w%3D580/sign=bbcf762fa986c91708035231f93c70c6/10c17c3e6709c93d5eca9c20913df8dcd0005407.jpg
I have implemented fuzzy searching using RegEx as shown below. I just want to get '1.0' and '1.01', But the results show figures such as '1.0' '1.01' '100' '100.10' and '110.11'. Why does 1.0 match 100 and 100.10? How can I only get 1.0 and 1.01?
db.getCollection ("CE").find (
{
"ID": /1.0/
}
);
the . in regex means any character, so 1.0 means a 1 followed by any character, followed by a 0. So 100, 1.0 , 1a0, etc are valid matches.
What you need to do is to escape the dot with a \. So replace your regex with 1\.0. Or with ^1\.0 if you want to only match strings that start with 1.0.
This question has probably been answered many times, please feel free to delete the question.

Why does order of operands matter when adding powershell strings and arrays? [duplicate]

This question already has answers here:
Why do integers in PowerShell compare by digits?
(4 answers)
Closed 4 years ago.
In powershell, when I add string + array the result is a string, but when I add array + string the result is an array? Why is that?
PowerShell converts the second operand to the type of the first operand (if it can).