Schema view year filed

Hi,

The schema view for the year filed, the graph showing min value is 1897, but when I go into a database I can see the value is 1894 for the {“title”:“Carmencita”}. After filtering dataset I can see three records. The first two have 1894, and the third has 1897.

Does MongoDB keep all values in 3D format and store updates over the old record?
If its case, how I can know what is the valid record?

here is the result when I want to see data with table view:

50

This is graph view:

33

Hi @Tarik_36467

Does MongoDB keep all values in 3D format and store updates over the old record?

I don’t think that’s what you’re seeing. These seem to be multiple records with the same title as they have different _ids.

I think the reason you did not see 1894 in the bar chart is that those value ranges are based on a sample that is selected when you ‘Analyze’ the schema. Notice at the top it says “This report is based on a sample of 1000 documents”. So what most likely happened is that the document with {"year"=1984} was not selected in the sample.

2 Likes

Understand.

I will see just one row if it is same row, all fields can be updated except ID?

So schema over view does not show 100% correct information for all data, just for sample of the 1000 rows, and if we want to be 100% sure, we need to include some kind of the filter?

Is this 1000 rows limitation of the tool, or this is just default parameter for inicial loading only ?

Kind regards

Hi Tarik_36467,

  1. You cannot update _id field of any document. Instead you can clone it and give it a new _id and insert it.
// store the document in a variable
doc = db.clients.findOne({_id: ObjectId("4cc45467c55f4d2d2a000002")})

// set a new _id on the document
doc._id = ObjectId("4c8a331bda76c559ef000004")

// insert the document, using the new _id
db.clients.insert(doc)

// remove the document with the old _id
db.clients.remove({_id: ObjectId("4cc45467c55f4d2d2a000002")})
  1. It shows the correct data but only for 1000 sample documents. You can read more about it here

Thanks, Kanika