Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support '.' in field names. #399

Closed
nathanjd opened this issue Apr 6, 2016 · 4 comments
Closed

[Feature Request] Support '.' in field names. #399

nathanjd opened this issue Apr 6, 2016 · 4 comments

Comments

@nathanjd
Copy link

nathanjd commented Apr 6, 2016

I am trying to save measurements from the react perf add on to the database, but cannot due to the restriction on '.' in field names. I would expect the database to handle all valid json objects but because of this restriction this is not the case. A sample attribute from the measurements is below:

{
    exclusive: {
            '.0.0.0.2.0': 2,
            '.0.0.0.2.1': 1,
            '.0.0.0.2.2.0.1.0': 1,
            '.0.0.0.2.2.0.2': 0,
            '.0.0.0.2.2.0': 1,
            '.0.0.0.2.2': 0,
            '.0.0.0.2.3': 1,
            '.0.0.0.2.4.0': 1,
            '.0.0.0.2.4.1': 2,
            '.0.0.0.2.4.3': 1,
            '.0.0.0.2.4': 1,
            '.0.0.0.3.0.0.0.1.$0.0.0': 1,
            '.0.0.0.3.0.0.0.1.$0.0.1.0.0': 0,
            '.0.0.0.3.0.0.0.1.$0.0.1': 1,
            '.0.0.0.3.0.0.0.1.$0': 1,
            '.0.0.0.3.0.0.0': 1,
            '.0.0.0.3.0.0': 0,
            '.0.0.0.3': 1,
            '.0.0.0.4.0.4.0.1': 0,
            '.0.0.0.4.0.4.0.3': 0,
            '.0.0.0.4.0.4': 2,
            '.0.0.0.4.0.5': 1,
            '.0.0.0.4.0.6': 0,
            '.0.0.0.4.0.7.1': 2,
            '.0.0.0.4.0.7.2.0': 2,
            '.0.0.0.4.0.7.2.1': 1,
            '.0.0.0.4.0.7': 2,
            '.0.0.0.4.0.8': 2,
            '.0.0.0.4.1.0.0.0.0': 1,
            '.0.0.0.4.1.0.0.1.0': 1,
            '.0.0.0.4.1.0.1.2.0.$twitter.0': 1,
            '.0.0.0.4.1.0.1.2.0.$google-plus.0': 1,
            '.0.0.0.4.1.0.1': 2,
            '.0.0.0.4.1.0': 1,
            '.0.0.0.4.2.0.0.0.1': 0,
            '.0.0.0.4.2.0.1.0.0': 0,
            '.0.0.0.4.2.0.1.0.1.0.3': 1,
            '.0.0.0.4.2.0.1.0.1.2': 0,
            '.0.0.0.4.2.0.1.0.1': 3,
            '.0.0.0.4.2.0.1.0.2': 1,
            '.0.0.0.4.2.0.1.0': 1,
            '.0.0.0.4.2.0': 4,
            '.0.0.0.4.2.1.1.0.0': 2,
            '.0.0.0.4.2.1.1.0': 0,
            '.0.0.0.4.2.1': 2,
            '.0.0.0.4.2.2.1.0.1': 1,
            '.0.0.0.4.2.2.1.0.2': 1,
            '.0.0.0.4.2.2.1.0': 0,
            '.0.0.0.4.2.2': 2,
            '.0.0.0.4.2.3.0.0.1.1': 1,
            '.0.0.0.4.2.3.1.0.0.1': 0,
            '.0.0.0.4.2.3.1.0.0.2': 0,
            '.0.0.0.4.2.3.1.0.0': 1,
            '.0.0.0.4.2.3.1.0.1.0': 0,
            '.0.0.0.4.2.3.1.0.1': 1,
            '.0.0.0.4.2.3.1.0': 0,
            '.0.0.0.4.2.3': 2,
            '.0.0.0.4.2': 1,
            '.0.0.0.4': 2,
            '.0.0.1': 1,
            '.0.0.2': 0,
            '.0.0.3.0': 0,
            '.0.0.3': 1,
            '.0.0.4.0.0.0.0:1': 0,
            '.0.0.4': 3,
            '.0.0.5.0.0.0.0:0.0': 0,
            '.0.0.5.0.0.0.0:0.3.0.1': 0,
            '.0.0.5.0.0.0.0:0.3.0': 2,
            '.0.0.5.0.0.0.0:0.3.1.1': 1,
            '.0.0.5.0.0.0.0:0.3.1': 0,
            '.0.0.5.0.0.0.0:0.3.2.1': 1,
            '.0.0.5.0.0.0.0:0.3.2': 0,
            '.0.0.5.0.0.0.0:0.3.3.0': 0,
            '.0.0.5.0.0.0.0:0.3': 1,
            '.0.0.5.0.0.0.0:1': 1,
            '.0.0.5': 1,
            '.0.0.6.1.0': 0,
            '.0.0.6': 1,
            '.0.0.8.0.0.0.0:1': 0,
            '.0.0.8': 2,
            '.0.1': 1,
            '.0': 30
    },
    ...
}

I could probably encode the periods with afterSerialization and beforeDeserialization but at that point, it's just easier to use a different database.

@nathanjd nathanjd changed the title Support '.' in field names. [Feature Request] Support '.' in field names. Apr 6, 2016
@bdfoster
Copy link

bdfoster commented Apr 7, 2016

Does MongoDB support this? If so, link some documentation.

Thanks.
On Apr 6, 2016 6:31 PM, "Nathan Dobrowolski" [email protected]
wrote:

I am trying to save measurements from the react perf add on to the
database, but cannot due to the restriction on '.' in field names. I would
expect the database to handle all valid json objects but because of this
restriction this is not the case. Sample attribute from the measurements is
below:

{
exclusive: {
'.0.0.0.2.0': 2,
'.0.0.0.2.1': 1,
'.0.0.0.2.2.0.1.0': 1,
'.0.0.0.2.2.0.2': 0,
'.0.0.0.2.2.0': 1,
'.0.0.0.2.2': 0,
'.0.0.0.2.3': 1,
'.0.0.0.2.4.0': 1,
'.0.0.0.2.4.1': 2,
'.0.0.0.2.4.3': 1,
'.0.0.0.2.4': 1,
'.0.0.0.3.0.0.0.1.$0.0.0': 1,
'.0.0.0.3.0.0.0.1.$0.0.1.0.0': 0,
'.0.0.0.3.0.0.0.1.$0.0.1': 1,
'.0.0.0.3.0.0.0.1.$0': 1,
'.0.0.0.3.0.0.0': 1,
'.0.0.0.3.0.0': 0,
'.0.0.0.3': 1,
'.0.0.0.4.0.4.0.1': 0,
'.0.0.0.4.0.4.0.3': 0,
'.0.0.0.4.0.4': 2,
'.0.0.0.4.0.5': 1,
'.0.0.0.4.0.6': 0,
'.0.0.0.4.0.7.1': 2,
'.0.0.0.4.0.7.2.0': 2,
'.0.0.0.4.0.7.2.1': 1,
'.0.0.0.4.0.7': 2,
'.0.0.0.4.0.8': 2,
'.0.0.0.4.1.0.0.0.0': 1,
'.0.0.0.4.1.0.0.1.0': 1,
'.0.0.0.4.1.0.1.2.0.$twitter.0': 1,
'.0.0.0.4.1.0.1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
'.0.0.8': 2,
'.0.1': 1,
'.0': 30
},
...
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#399

@louischatriot
Copy link
Owner

In any case this is not going to be supported as the dot is used as separator for fields.

@nathanjd
Copy link
Author

nathanjd commented Apr 8, 2016

@bdfoster Good point, I hadn't considered that. I was thinking of this in the context of what would be supported by "THE Javascript Database" I've been hoping to get out of this package given its minimal dependencies. I'm relatively new to MongoDB so haven't got all the mongo-isms down.

Great work on this btw! It's my go-to for personal projects.

@JamesMGreene
Copy link
Contributor

JamesMGreene commented Feb 21, 2017

Just to close the loop here: MongoDB also does NOT support using periods in field names.

https://docs.mongodb.com/manual/core/document/#field-names

Documents have the following restrictions on field names:

  • The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array.
  • The field names cannot start with the dollar sign ($) character.
  • The field names cannot contain the dot (.) character.
  • The field names cannot contain the null character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants