Ranco
Ranco

Reputation: 893

mongodb dot notation find

finding a record with dot notation is possible via mongo shell for example:

db.events.find({'events.eid':307215649389788})

I'm trying to achieve the same thing with java drivers, problem is:

how can I overcome this?

Upvotes: 1

Views: 1208

Answers (1)

JohnnyHK
JohnnyHK

Reputation: 311845

Not quite sure what you're trying, but this works:

DBCursor cursor = coll.find(new BasicDBObject("events.eid", 307215649389788));

You need to use double quotes (") with Java strings so if you're using single quotes that's your problem.

Upvotes: 2

Related Questions