Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.10.0
-
None
-
Minor Change
Description
The java driver, by virtue of doing a null check on the `get("_id")` instead of a `containsField("_id")`, will try to set the `_id` to a new `ObjectId`. Not sure about all of the other drivers, but the javascript driver allows `null`. With respect to the use case of trying to replicate an existing collection, this causes a problem.
In DBCollection.java:
public Object apply( DBObject jo , boolean ensureID ){
|
|
|
Object id = jo.get( "_id" );
|
if ( ensureID && id == null ){
|
id = ObjectId.get();
|
jo.put( "_id" , id );
|
}
|
|
|
doapply( jo );
|
|
|
return id;
|
}
|
Attachments
Issue Links
- depends on
-
JAVA-467 Calling setReadPreference(ReadPreference.SECONDARY) is not reading from secondary servers
-
- Closed
-