I tried to insert the following DBObject into MongoDB using Spring Data:
BasicDBObject document = new BasicDBObject(); document.put(\"country\", \"us\");
Another way to do this is to directly access the DBCollection object via the MongoTemplate:
DBCollection
MongoTemplate
DBObject company = new BasicDBObject(); ... DBCollection collection = mongoTemplate.getCollection("company"); collection.insert(company);