I would like to retrieve every document with a patchName(String), which contains a given phrase. E.g. "When the user submits a keyword "S2A", he will acquire all matching documents with patch names i.e., "patchName" : "S2A_MSIL2A_20170613T101031_0_64". Since I would like that the phrase is contained into the patch name, I decided to go with $regex, since a text index searches only exact phrases. I managed it to submit the query in the mongodb shell, however, I am not able to reproduce it inside the Spring Boot Repository class at server-side. Hereby I attach some screenshots:
And here is the analogous query, submitted from Spring Boot Repository class:
And this is how I invoke it (p.s. I tried several approaches, but still nothing):
Whichever approach I take, it still does not work. Even if I submit the exact patch name of the document, it does not retrieve it.
Hereby I provide you with two example documents (the data originates from the BigEarthNet archive (http://bigearth.net/):
{
"_id" : ObjectId("60531c9be17ae9783919549b"),
"type" : "Feature",
"location" : [
[
20.9996003792675,
63.3486882292739
],
[
20.9996003792675,
63.3379164659186
],
[
21.0235688072459,
63.3379164659186
],
[
21.0235688072459,
63.3486882292739
],
[
20.9996003792675,
63.3486882292739
]
],
"properties" :
{
"patchName" : "S2A_MSIL2A_20170613T101031_0_63",
"labels" : [
"f"
],
"acquisitionDate" : ISODate("2017-01-13T09:10:31Z")
}
,
"_class" : "com.tuberlin.dbpro.models.database.MetaJson"
}
{
"_id" : ObjectId("60531c9be17ae9783919549c"),
"type" : "Feature",
"location" : [
[
20.9996005286705,
63.3379184119332
],
[
20.9996005286705,
63.3271466330944
],
[
21.0235599998921,
63.3271466330944
],
[
21.0235599998921,
63.3379184119332
],
[
20.9996005286705,
63.3379184119332
]
],
"properties" :
{
"patchName" : "S2A_MSIL2A_20170613T101031_0_64",
"labels" : [
"f"
],
"acquisitionDate" : ISODate("2017-01-13T09:10:31Z")
}
,
"_class" : "com.tuberlin.dbpro.models.database.MetaJson"
}