Skip to content

Unable to save Map<String, ?> when one of it's keys starts with dollar sign [DATAMONGO-604] #1533

@spring-projects-issues

Description

@spring-projects-issues

Siarhei Krukau opened DATAMONGO-604 and commented

MongoDB cannot store JSON keys, starting from "$". So, when we try to save a Map with a $-starting key, mongo fails with:

fields stored in the db can't start with '$' (Bad Key: '$key')

My current workaround is to extend org.springframework.data.mongodb.core.convert.MappingMongoConverter and override potentiallyEscapeMapKey(String). Maybe this is good to be in master?


Affects: 1.1 GA

Reference URL: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/5UQYAQ6o5Wg

Attachments:

3 votes, 4 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: mappingMapping and conversion infrastructuretype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions