Class ChangeStreamOperation
- java.lang.Object
-
- org.restheart.mongodb.handlers.changestreams.ChangeStreamOperation
-
public class ChangeStreamOperation extends Object
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>, Omar Trasatti <omar@softinstigate.com>
-
-
Field Summary
Fields Modifier and Type Field Description static StringSTAGES_ELEMENT_NAMEstatic StringSTREAM_ELEMENT_NAMEstatic StringURI_ELEMENT_NAME
-
Constructor Summary
Constructors Constructor Description ChangeStreamOperation(org.bson.BsonDocument properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.bson.BsonValuebindAggregationVariables(org.bson.BsonValue obj, org.bson.BsonDocument aVars)static voidcheckAggregationVariables(org.bson.BsonValue aVars)checks if the aggregation variable start with $ this is not allowed since the client would be able to modify the aggregation stagesstatic List<ChangeStreamOperation>getFromJson(org.bson.BsonDocument collProps)List<org.bson.BsonDocument>getResolvedStagesAsList(org.bson.BsonDocument vars)org.bson.BsonArraygetStages()StringgetUri()
-
-
-
Field Detail
-
STREAM_ELEMENT_NAME
public static final String STREAM_ELEMENT_NAME
- See Also:
- Constant Field Values
-
URI_ELEMENT_NAME
public static final String URI_ELEMENT_NAME
- See Also:
- Constant Field Values
-
STAGES_ELEMENT_NAME
public static final String STAGES_ELEMENT_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChangeStreamOperation
public ChangeStreamOperation(org.bson.BsonDocument properties) throws InvalidMetadataException- Parameters:
properties-- Throws:
InvalidMetadataException
-
-
Method Detail
-
getFromJson
public static List<ChangeStreamOperation> getFromJson(org.bson.BsonDocument collProps) throws InvalidMetadataException
- Parameters:
collProps-- Returns:
- Throws:
InvalidMetadataException
-
checkAggregationVariables
public static void checkAggregationVariables(org.bson.BsonValue aVars) throws SecurityExceptionchecks if the aggregation variable start with $ this is not allowed since the client would be able to modify the aggregation stages- Parameters:
aVars- RequestContext.getAggregationVars()- Throws:
SecurityException
-
getUri
public String getUri()
- Returns:
- the uri
-
getStages
public org.bson.BsonArray getStages()
- Returns:
- the stages
-
getResolvedStagesAsList
public List<org.bson.BsonDocument> getResolvedStagesAsList(org.bson.BsonDocument vars) throws InvalidMetadataException, QueryVariableNotBoundException
- Parameters:
vars- RequestContext.getAggregationVars()- Returns:
- the stages, with unescaped operators and bound variables
- Throws:
InvalidMetadataExceptionorg.restheart.mongodb.handlers.changestreams.QueryVariableNotBoundExceptionQueryVariableNotBoundException
-
bindAggregationVariables
protected org.bson.BsonValue bindAggregationVariables(org.bson.BsonValue obj, org.bson.BsonDocument aVars) throws InvalidMetadataException, QueryVariableNotBoundException- Parameters:
obj-aVars- RequestContext.getAggregationVars()- Returns:
- the json object where the variables ({"_$var": "var") are replaced with the values defined in the avars URL query parameter
- Throws:
InvalidMetadataExceptionorg.restheart.mongodb.handlers.changestreams.QueryVariableNotBoundExceptionQueryVariableNotBoundException
-
-