Hello,
I am trying to alias the _id field in a Realm function using the find() method.
According to the documentation, the second parameter in the find() method is a projection.
I have a collection called students with the following fields
_id, firstName, lastName, accountId
I am attempting to alias the return using a projection
Here is a code snippet:
const query = { };
const projection = { _id_:1, studentId: "$_id", };
await students.find(query, projection).toArray()
Here are my results
[
{"_id":“5e8fc09770f5e3f18c730a21”},{"_id":“5e8fc40470f5e3f18c730a22”},{"_id":“5e90838738eff556f0fa48d0”},{"_id":“5e9086a138eff556f0fa48d1”},{"_id":“5e908dba38eff556f0fa48d2”},{"_id":“5eea898c1a3f23cd2980e699”}]
The alias did not work and I am also missing the other fields.
Anyone have an idea? I went through the Realm docs and the samples are very scarce