feliixx / mongoplayground

a simple sandbox to test and share MongoDB queries
https://mongoplayground.net
GNU Affero General Public License v3.0
176 stars 12 forks source link

Epoch values (10byte number) from the sample data is being shown in the output in scientific format. #173

Open soorajsprakash opened 3 months ago

soorajsprakash commented 3 months ago

Hi, So, have been using the playground recently (and its fun, thanks), And while I was testing out some aggregation pipelines, i found out that even after a mere $match stage, epoch data (10 byte long number) was being shown in an exponential/scientific format in the output.

It will most likely a formatter issue.

Ex: 1658318035 -> 1.658318035e+09

Sample data:

[
  {
    "collection": "collection",
    "count": 100,
    "createdAt": 1658318035
  }
]

Query:

db.collection.aggregate([
  {
    "$match": {
      count: 100
    }
  }
])

Output:

[
  {
    "_id": ObjectId("5a934e000102030405000000"),
    "collection": "collection",
    "count": 100,
    "createdAt": 1.658318035e+09
  }
]
feliixx commented 3 months ago

Hi @soorajsprakash, thanks for reporting this !

I agree that it's weird to have this field formatted differently, We could probably tweak the driver to prevent it from formatting these numbers. I'll try to give it a shot next week

soorajsprakash commented 3 months ago

Thanks