I'm currently trying to query a collection using a mix of literals and variables. For some reason the result comes back as null when I do this.
const result = await db.getCollection('myCollection').findOne({
'someDate.someId': line['someId'],
});
// returns 'null'
However, if use a either both variables or both literals, it works just fine:
const key = 'someDate.someId'
const result = await db.getCollection('myCollection').findOne({
key: line['oldId'], // or 'key:value' could be both literals
});
// returns the result I am looking for
Why can I not do what I am trying to do in the first example? It's somewhat inconvenient to have to create a variable for the query - is there a way I achieve what I want without doing this?