MongoDB data consistency with Jongo and Java synchronization

desperate

New Member
Hello I am wondering how MongoDB ensure data insertion and updating.I have list of class \[code\]Game\[/code\] where each Game has a \[code\]listOfPlayers\[/code\].I am passing each game to an \[code\]ExecutorService\[/code\]'s \[code\]Runnable\[/code\] to split the work of inserting and updating Players records.Like:\[code\]doDirtyJobThread doit = new doDirtyJobThread(aGame); //pass the Runnable object to the executor serviceFuture future = executorService.submit(doit);futureList.add(future);\[/code\]doDirtyJobThread will has a run method\[code\]@Override public void run(){ //iterate the list and build players information //insert the player if doesn't exist //update the player it already exists }\[/code\]What happens when I update or insert the Player into my \[code\]MongoCollection\[/code\], do I have any kind of security/Atomicity running this code in parallel?If I am not wrong NoSQL databases do not have ACID, right? So, should I worry about putting the updating and insertion code into a \[code\]synchronised\[/code\] block?please suggest.Many thanks
 
Back
Top