0

I have a java object which I need to save in mongoDB and the identifier in mongoDB is typically a complex one, with two fields: _id.valueA and _id.valueB .

However, my data structure is flat with respect to valueA and valueB (i.e. these are two properties of my java class and they are not nested inside an ID) and the natural way to map them was to create two properties in a BasicDBObject.

When I try to save this basicDBObject I get an exception:

fields stored in the db can't have . in them. (Bad Key: '_id.ticker') java.lang.IllegalArgumentException: fields stored in the db can't have . in them. (Bad Key: '_id.ticker')

Why does this occurs? Isn't what I am doing a legal operation in mongoDB?

Edmondo
  • 19,559
  • 13
  • 62
  • 115

0 Answers0