Skip to content

QueryMapper drops numeric keys in Maps. [DATAMONGO-1269] #2188

Closed
@spring-projects-issues

Description

@spring-projects-issues

Christoph Strobl opened DATAMONGO-1269 and commented

As of 1.7.1 numeric keys get dropped in query mapping.

@Test
public void SO_31799474() {

	SomeContent content = new SomeContent();
	content.text = "foo";

	SO31799474 entity = new SO31799474();
	entity.id = "id-1";

	entity.map = Collections.singletonMap(Integer.valueOf(1), content);

	template.save(entity);

	assertThat(template.findOne(query(where("map.1.text").is("foo")), SO31799474.class), notNullValue());
}

static class SO31799474 {
	String id;
	Map<Integer, SomeContent> map;

	@Override
	public String toString() {
		return "SO31799474 [id=" + id + ", map=" + map + "]";
	}

}

Affects: 1.7.1 (Fowler SR1), 1.7.2 (Fowler SR2), 1.8 RC1 (Gosling)

Reference URL: http://stackoverflow.com/questions/31799474/mongodb-spring-data-hashmap-query-search-for-numeric-key

Issue Links:

  • DATAMONGO-1210 Inconsistent property order of _class type hint breaks document equality

Referenced from: pull request #314

Backported to: 1.7.3 (Fowler SR3)

1 votes, 3 watchers

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions