I'm attempting to retrieve the most recent messages between User A and any other user.
Unfortunately, I am encountering an error message that states:
The field name '$acknowledged' cannot be an operator name
I am unsure of what mistake I might be making. Here is a link to the Mongo playground.
The desired outcome is to display the latest message exchanged between a user with the ID 5a934e000102030405000001
and another user.
[
{
"from": ObjectId("5a934e000102030405000002"),
"to": ObjectId("5a934e000102030405000001"),
"acknowledged": true,
date: "2020-04-17T18:26:34.353+00:00"
},
{
"from": ObjectId("5a934e000102030405000001"),
"to": ObjectId("5a934e000102030405000003"),
"acknowledged": false,
date: "2020-04-17T18:26:31.353+00:00"
},
{
"from": ObjectId("5a934e000102030405000004"),
"to": ObjectId("5a934e000102030405000001"),
"acknowledged": false,
date: "2020-04-17T18:26:29.353+00:00"
},
]