[JAVA-2739] Getter for Namespace in Aggregation Operation Created: 21/Jan/18  Updated: 11/Oct/18  Resolved: 11/Oct/18

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial - P5
Reporter: Fethullah Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

The class com.mongodb.operation.FindOperation does provide already a getter for the "namespace" field. Can you please also provide the getter in com.mongodb.operation.AggregateOperation?



 Comments   
Comment by Jeffrey Yemin [ 11/Oct/18 ]

We plan to deprecate the operation classes in the next release and then move them to an internal package. As such, we won't be enhancing any operation classes for public use.

Comment by Fethullah [ 22/Jan/18 ]

Hi Ross,

for me it is pretty difficult to write good tests for components which are retrieving data from MongoDB.
The available inmemory databases do not completely support aggregate queries which i'am using extensivly in my personal project.

Therefor i developed a small library. The library delegates MongoDB queries to a HTTP Server (WireMock) using a custom AsyncOperationExecutor. The response will be parsed to Document(s) and passed to SingleResultCallback of the executor.
This approach allows me to write tests for my MongoDB components, as simple as writing tests for external HTTP API's.

To improve the stub matching, i need the collectionName from the namespace of AggregateOperation.
I implemented already a workaround using reflection. But it would be getter so that it is consistent with FindOperation.

Fethullah

Comment by Ross Lawley [ 22/Jan/18 ]

Hi fmisir,

I'm interested to hear that you are using the Operations classes directly. Can you explain more about your usecase? And any reasoning for using them over the higher API's? eg: the Mongo Java Driver / Async Driver

Ross

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