collection.find(eq(field, value)).first();
Hi
I am having awful trouble trying to retrieve values using dot notation.
Do you mean that the key part of a document e.g. {key: value} contains a dot?
If yes, then it’s not possible to create a document with a key with a dot in its name. For example, you cannot create a document like this (it will result in an error):
> db.test.insert({"user.name": "foo"}) //will result in an error
This is because MongoDB interprets dots as a special operator (see Dot Notation), which was designed to query a sub-document. For example:
> db.test.find({'user.name':'foo'})
{
"_id": 1,
"user": {
"name": "foo"
}
}
If this is not your intent, could you please provide more detail:
Best regards,
Kevin