[JAVA-1399] Using BasicDBObjects, what happens if I append the same key more than once? Created: 19/Aug/14  Updated: 11/Sep/19  Resolved: 20/Aug/14

Status: Closed
Project: Java Driver
Component/s: Documentation, Query Operations
Affects Version/s: 2.12.3
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Antonio Quintana Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I haven't found in any javadoc or documentation what's the behavior of the BasicDBObject.append() with this code:

BasicDBObject query;
query.append("propertyName", value);
.... // more code, maybe a loop
query.append("propertyName", anotherValue);

Is this the JS equivalent of: query =

{propertyName: value, propertyName:anotherValue}

?

I know what does exactly happen in JS, but in Java I'm not sure.



 Comments   
Comment by Ross Lawley [ 20/Aug/14 ]

Hi,

I'm closing this as Jeff answered your question. Just for future reference the JAVA project is for reporting bugs and feature requests regarding the Java driver itself. The best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a boarder audience there.

Ross

Comment by Jeffrey Yemin [ 19/Aug/14 ]

It's last one wins. Underneath it's a Map with the property name as the key

Generated at Thu Feb 08 08:54:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.