[JAVA-3452] java.lang.IllegalArgumentException: Invalid BSON field name Created: 01/Oct/19  Updated: 27/Oct/23  Resolved: 01/Oct/19

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Amol Potbhare Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DRIVERS-618 Add escaping convention for dot and d... Closed
related to JAVA-3996 Remove restrictions on using field na... Closed
related to SERVER-30575 Please add escaping convention for do... Backlog

 Description   

I am facing issue as "java.lang.IllegalArgumentException: Invalid BSON field name center.alignment.threshold". center.alignment.threshold is my key which contains "dot" in it. I have gone through few of the internet sites and got to know that the "dot" and "doller" sign is not supported in mongodb. I have not got any resolution for this problem.

Can you please just suggest the alternative here...

Update

in scope of JAVA-3996, the restriction on dots and dollars in field names has been removed from the driver. This was included in the 4.3.0 release of the driver (and all subsequent releases).



 Comments   
Comment by Jeffrey Yemin [ 25/Jul/23 ]

FYI: in scope of JAVA-3996, the restriction on dots and dollars in field names has been removed from the driver. This was included in the 4.3.0 release of the driver (and all subsequent releases).

Comment by Sergiu Starciuc [ 29/Mar/20 ]

 

From mongoDB reference manual: "...Otherwise, starting in MongoDB 3.6, the server permits storage of field names that contain dots (i.e. .) and dollar signs (i.e. $)..."

See https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names

Comment by Jeffrey Yemin [ 01/Oct/19 ]

Hi potbhare.amol@gmail.com

At this point MongoDB drivers do not support dots in field names. The only workaround is to replace the "." character with a different character, e.g. "_". The reasons are complicated, but generally have to do with the semantics of the "." character in the MongoDB query language, where "." is used to indicate a path into an embedded document. For example, the query filter

{"a.b" : 1}

matches this document

{"a" : {"b" : 1}}

but does not match this document:

{"a.b": 1}

Comment by Amol Potbhare [ 01/Oct/19 ]

Hi Team,

I have recently started working on MognoDB and I loved using it. I am facing issue as "java.lang.IllegalArgumentException: Invalid BSON field name center.alignment.threshold". center.alignment.threshold  is my key which contains "dot" in it. I have gone through few of the internet sites and got to know that the "dot" and "doller" sign is not supported in mongodb.  I have not got any resolution for this problem. 

Can you please just suggest the alternative here...

Thanks in advance 

Generated at Thu Feb 08 08:59:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.