[SERVER-45294] mapReduce can no longer create an output collection in a sharded cluster (4.3.2) Created: 23/Dec/19  Updated: 27/Oct/23  Resolved: 02/Jan/20

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 4.3.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Shane Harvey Assignee: Backlog - Query Team (Inactive)
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File PYTHON-2072.py    
Issue Links:
Related
related to PYTHON-2072 MR in Agg: Remove in-line mapReduce e... Closed
Assigned Teams:
Query
Operating System: ALL
Participants:

 Description   

I noticed while working on PYTHON-2072 that mapReduce can no longer create a collection in a missing database:

$ python3.8 PYTHON-2072.py
Server version:  4.3.2-392-gd6cc8fa
Is mongos?  True
mapReduce out to missing database:
{'ok': 0.0, 'errmsg': 'database missing not found', 'code': 26, 'codeName': 'NamespaceNotFound'}
mapReduce out to missing collection:
{'result': {'db': 'test', 'collection': 'missingcoll2'}, 'ok': 1.0}
$ python3.8 PYTHON-2072.py
Server version:  4.3.2-392-gd6cc8fa
Is mongos?  False
mapReduce out to missing database:
{'result': {'db': 'missing', 'collection': 'missingcoll1'}, 'ok': 1.0}
mapReduce out to missing collection:
{'result': {'db': 'test', 'collection': 'missingcoll2'}, 'ok': 1.0}

On 4.2 mapReduce can create the output collection regardless of if the database exists.



 Comments   
Comment by Shane Harvey [ 02/Jan/20 ]

Thanks! Feel free to close this ticket however you like. I've already updated the Python driver's tests to always create the output database to workaround this change.

Comment by James Wahlin [ 02/Jan/20 ]

shane.harvey the ability for mapReduce to write to a collection in a non-existent database has been removed for MongoDB 4.4. The mapReduce command now executes via the aggregation framework which disallows this for the $out and $merge stages. Users will be required to create the target database and optionally the collection and shard this collection if desired.

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