Skip to content

Tag: mongodb

Convert from LinkedHashMap to Json String

I’m Workin with Mongo using Jongo, when I do a query I receive a LinkedHashMap as result. the problem is that if the json is {“user”:”something”} content will be {user=something}, it is not a json is only toString method from HashMap. How I can get the original JSON? I don’…

Mongodb avoid duplicate entries

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? Answer Use an index with the {unique:true} option. You can also do this across multiple fields. See this section in the docs for more det…