I've different results querying a mongo document using regex and text search. If I use regex I obtain results:
db.planning.find({"year":2018, "data":{$regex: ".*#A.*"}})
{ "_id" : ObjectId("5bf2964723eeeb59ef26dc69"), "date" : ISODate("2018-04-10T00:00:00Z"), "month" : 4, "instrument" : "AV500", "day" : 10, "data" : "N2 / Zizic #A (MP)", "year" : 2018 }
{ "_id" : ObjectId("5bf2964823eeeb59ef26dcd5"), "date" : ISODate("2018-04-11T00:00:00Z"), "month" : 4, "instrument" : "AV500", "day" : 11, "data" : "Zizic #A (MP)", "year" : 2018 }
{ "_id" : ObjectId("5bf2964823eeeb59ef26dccd"), "date" : ISODate("2018-04-12T00:00:00Z"), "month" : 4, "instrument" : "AV500", "day" : 12, "data" : "Zizic #A (MP)", "year" : 2018 }
If I use text search I don't obtain results:
db.planning.find({"year":2018, $text:{$search: "#A"}})
Is there a reason? # is a special character in mongo?