protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		JSONObject jb = new JSONObject();
		InputStreamReader reader = 
				new InputStreamReader(request.getInputStream(), "utf-8"); 
		String receivedString = "";
		char[] buff = new char[1024]; 
		int length = 0; 
		while ((length = reader.read(buff)) != -1) 
		{ 
			receivedString = new String(buff, 0, length); 
		}
		try {
			JSONObject receivedObject = new JSONObject(receivedString);
			String userId = receivedObject.getString("userId");
			JSONArray friends = receivedObject.getJSONArray("friends");
			String groupName = receivedObject.getString("groupName");
			try{
				Mongo mongo =new Mongo();
				DB scheduleDB = mongo.getDB("schedule");
				DBCollection groupCollection = scheduleDB.getCollection("group_"+userId);
				DBObject groupDBObject = new BasicDBObject();
				groupDBObject.put("groupName", groupName);
				WriteResult wr = groupCollection.save(groupDBObject);
				if(wr.getN() != 0){
					jb.put("result", Primitive.DBSTOREERROR);
				}else{
					int i;
					for(i =0; i < friends.length(); i++){
						DBObject updateObject = new BasicDBObject();
						DBObject member = new BasicDBObject();
						String memberId = friends.getString(i);
						member.put("member", memberId);
						updateObject.put("$push", member);
						DBObject updateQuery = new BasicDBObject();
						String groupId = groupDBObject.get("_id").toString();
						updateQuery.put("_id", new ObjectId(groupId));
						WriteResult wr2 =groupCollection.update(
								updateQuery, updateObject);
						if(wr2.getN() == 0){
							jb.put("result", Primitive.DBSTOREERROR);
							break;
						}
					}
					if( i == friends.length()){
						jb.put("result", Primitive.ACCEPT);
						jb.put("groupId", groupDBObject.get("_id").toString());
					}
				}
				
			}catch(MongoException e){
				jb.put("result", Primitive.DBCONNECTIONERROR);
				e.printStackTrace();
			}
		} 
		catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		PrintWriter writer = response.getWriter();
		writer.write(jb.toString());
		writer.flush();
		writer.close();
	}