I am newbie to mongodb. May I know how to avoid duplicate entries. In relational tables, we use primary key to avoid it. May I know how to specify it in Mongodb using java?<
Theon solution didn't work for me, but this one did:
BasicDBObject query = new BasicDBObject(, 1); collection.ensureIndex(query, , true);