The field value contains a string with an apostrophe "Dreams I'll Never See" in the mongo collection field recording.title
$updateResult = $collection->findOneAndUpdate(
[
'recording-id' => $out['recording']->id
],
['$set' => [
'recording' => [
'id' => $out['recording']->id,
'title' => $out['recording']->title,
'score' => $out['recording']->score,
'length' => $out['recording']->length,
'release-count' => count($out['recording']->releases)
]
],
['upsert' => true]);
This properly creates my record in my collection when one does not exist, and does not create several new ones when run again, however when I search for the title "Dreams I'll Never See" it doesn't find a match.
Example of my search code:
$t = "Dreams I'll Never See";
$a = "Molly Hatchet";
$cursor = $collection->find(
['$and' => [
[ 'recording.title' => $t ],
[ 'artist.name' => $a ]
]
],
['projection' => [
'recording' =>1,
'release' =>1,
'artist' =>1,
'release-group' =>1
],
['limit' => 1]
]
);
I've googled all morning, but just can't seem to get this working correctly.
Mongo shell displays the record field stored:
"recording" : {
"id" : "446ff065-a9bb-4171-a0d9-dbfa29661f99",
"title" : "Dreams I’ll Never See",
"score" : 100,
"length" : 428000,
"release-count" : 13
},