Skip to content

Commit

Permalink
Return "id" instead of "_id" for message decorators
Browse files Browse the repository at this point in the history
Fixes #2734
  • Loading branch information
bernd committed Aug 24, 2016
1 parent ee9653a commit 5e1c33c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.auto.value.AutoValue;
import org.graylog2.database.CollectionName;
import org.hibernate.validator.constraints.NotBlank;
import org.mongojack.Id;
import org.mongojack.ObjectId;

import javax.annotation.Nullable;
Expand All @@ -32,7 +33,7 @@
@JsonAutoDetect
@CollectionName("decorators")
public abstract class DecoratorImpl implements Decorator, Comparable {
static final String FIELD_ID = "_id";
static final String FIELD_ID = "id";
static final String FIELD_TYPE = "type";
static final String FIELD_CONFIG = "config";
static final String FIELD_STREAM = "stream";
Expand All @@ -48,6 +49,7 @@ public int compareTo(Object o) {
}

@JsonProperty(FIELD_ID)
@Id
@ObjectId
@Nullable
@Override
Expand All @@ -73,7 +75,7 @@ public int compareTo(Object o) {
public abstract Builder toBuilder();

@JsonCreator
public static DecoratorImpl create(@JsonProperty(FIELD_ID) @Nullable String id,
public static DecoratorImpl create(@JsonProperty(FIELD_ID) @Id @ObjectId @Nullable String id,
@JsonProperty(FIELD_TYPE) String type,
@JsonProperty(FIELD_CONFIG) Map<String, Object> config,
@JsonProperty(FIELD_STREAM) Optional<String> stream,
Expand Down

0 comments on commit 5e1c33c

Please sign in to comment.