-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add namespace type support to ChangeStreamDocument. #1736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vbabanin
wants to merge
5
commits into
mongodb:main
Choose a base branch
from
vbabanin:JAVA-5769
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+237
−11
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b4df333
Add namespace type support to ChangeStreamDocument.
vbabanin c7f97bf
Remove nsType documentation.
vbabanin e0c7b78
Remove since tag from NamespaceType documentation.
vbabanin 3cd0bd1
Fix codenarc.
vbabanin 9ff659f
Merge branch 'main' into JAVA-5769
vbabanin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
driver-core/src/main/com/mongodb/client/model/changestream/NamespaceType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.mongodb.client.model.changestream; | ||
|
||
import com.mongodb.lang.Nullable; | ||
|
||
/** | ||
* Represents the type of the newly created namespace object in change stream events. | ||
* <p> | ||
* Only present for operations of type {@code create} and when the {@code showExpandedEvents} | ||
* change stream option is enabled. | ||
* </p> | ||
* | ||
* @since 5.6 | ||
* @mongodb.server.release 8.1 | ||
*/ | ||
public enum NamespaceType { | ||
COLLECTION("collection"), | ||
TIMESERIES("timeseries"), | ||
VIEW("view"), | ||
/** | ||
* The other namespace type. | ||
* | ||
* <p>A placeholder for newer namespace types issued by the server. | ||
* Users encountering OTHER namespace types are advised to update the driver to get the actual namespace type.</p> | ||
* | ||
* @since 5.6 | ||
*/ | ||
OTHER("other"); | ||
|
||
private final String value; | ||
NamespaceType(final String namespaceTypeName) { | ||
this.value = namespaceTypeName; | ||
} | ||
|
||
/** | ||
* @return the String representation of the namespace type | ||
*/ | ||
public String getValue() { | ||
return value; | ||
} | ||
|
||
/** | ||
* Returns the ChangeStreamNamespaceType from the string value. | ||
* | ||
* @param namespaceTypeName the string value. | ||
* @return the namespace type. | ||
*/ | ||
public static NamespaceType fromString(@Nullable final String namespaceTypeName) { | ||
if (namespaceTypeName != null) { | ||
for (NamespaceType namespaceType : NamespaceType.values()) { | ||
if (namespaceTypeName.equals(namespaceType.value)) { | ||
return namespaceType; | ||
} | ||
} | ||
} | ||
return OTHER; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "NamespaceType{" | ||
+ "value='" + value + "'" | ||
+ "}"; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.