this is my code to insert something to mongoDB
List<DBObject> write=new ArrayList<DBObject>(); //write is a list of objects //i am using loop to get each object from list.
DBObject doc = new BasicDBObject("product_name", item.getName()). append("product_url", item.getUrl()). append("product_img", item.getImage()). append("product_price", item.getPrice()). append("time",item.getTime()). append("category", item.getCategory()); write.add(doc); // t = db.getCollection(table); t.insert(write);
when i tried this with price as string value no error.. i want to change price to double value for that i changed my price to double and then i changed my code as
getdouble("product_price", item.getPrice()); //used this instead of .append but then error and telling me to change doc to double.. but i cant change doc to double because other values are string and it will again show error..
Please tell me how to insert double with other string values to mongoDB
I am a new to MongoDB