jboss / jboss-nosql

3 stars 0 forks source link

Connection properties for MongoDB #6

Closed scottmarlow closed 8 years ago

scottmarlow commented 8 years ago

Add connection properties for MongoDB subsystem, so that "writeConcern" can be specified.

<subsystem xmlns="urn:jboss:domain:mongodb:1.0">
 <mongo name="default" id="mongodbtestprofile" jndi-name="java:jboss/mongodb/test" database="mongotestdb">
   <properties>
     <property name="writeConcern">ACKNOWLEDGED</property>
     <property name="readPreference">MAJORITY</property>
   </properties>
   <host name="default" outbound-socket-binding-ref="mongotesthost"/>
   </mongo>
</subsystem>
gytis commented 8 years ago

I've tried adding properties in a following way:

<properties name="default">
  <property name="writeConcern" value="ACKNOWLEDGED"/>
</properties>

But I cannot use name attribute, because it is used to name profile. Seems that we need to use different name for "name" attribute. Or is there a way to not require a profile name for "property" element?

scottmarlow commented 8 years ago

Could you try something like the following:

<properties name="default">
 <property property-name="writeConcern" property-value="ACKNOWLEDGED"/>
</properties>
gytis commented 8 years ago

Yeah something like that will work. Will still need to add name="default" to the property though.

scottmarlow commented 8 years ago

In the interest of moving forward, I think you should do what works and then we can get feedback on improvements that are possible before the changes are merged into WildFly.

gytis commented 8 years ago

Sounds right

gytis commented 8 years ago

@scottmarlow, did you introduce the requirement for name attribute in every element or is it coming from somewhere else? I'm currently getting "duplicate element exception" when adding two properties with name="default". Changing the name in one of them removes the problem, but that isn't correct as far as I understand.

scottmarlow commented 8 years ago

I didn't purposely introduce the "duplicate element exception", that seems to come in when we allow multiple NoSQL connection profiles per NoSQL subsystem (that we needed "name" and it seems to be a requirement that it be unique).

scottmarlow commented 8 years ago

Please close this issue when your done with it. The NoSQL unit tests also passed for me locally.