0

I have a collection with numbers as field names.

    {
      "_id" : ObjectId("5d8bae78577c111a86605d39"),
      "subject" : "ABAD001",
      "10" : 1556.9,
      "30" : 1325.94
    }

I can't print the "numeric" field

 db.collection.findOne().10

This is the error:

[js] SyntaxError: missing ; before statement

How I could access the "numeric" fields?

I tried

db.collection.findOne().['10']

But it does not work

Juan
  • 339
  • 3
  • 15
  • You can try something like this in the shell to get the first document that has a field key of "10" - `db.collection.findOne({"10":{$exists: true}})`. What are you attempting to do? – DaveStSomeWhere Sep 29 '19 at 19:38
  • `db.collection.findOne()['10']`. You did not need the **"dot"**. – Neil Lunn Sep 29 '19 at 23:13

0 Answers0