jameswang
jameswang

Reputation: 1

spring data mongo transition

No collection was created in Mongo(No user collection), Using template to save objects(save user object)

   @Transactional
   public void saveSingleObject() {
        template.save(new User("james", "james", 'ddd'));
   }

exception : Command failed with error 263 (OperationNotSupportedInTransaction): 'Cannot create namespace test-mongo.processes in multi-document transaction.

but User collection in mongo , no exception

Upvotes: 0

Views: 2025

Answers (1)

Biplab
Biplab

Reputation: 139

This is happening since as per Mongo documentation "a multi-document transaction cannot include an insert operation that would result in the creation of a new collection." For more please refer here.

Upvotes: 2

Related Questions