So, I am creating an application using PHP and MongoDB that will have a fair bit of traffic when reading and writing. After a couple of months, there should be about 2500 views per second and 200 entries per second (not sure how it really is estimated in terms of traffic compared to others, though).
I'm a little curious about what to do when updating a collection; The sample documentation shows a shell that updates a specific field in the collection, but does not explain what happens when you can change any number of fields from the collection.
For example, let's say I have a custom collection (a very simplified example):
user = {
_id: MongoId (...),
name: 'User One',
email: ' email@address.com ',
company: 'Company',
...
}
We show all editable fields on the form, but the user only changes his email address.
Strictly speaking, in terms of performance, would it be better to store the original values ββin hidden inputs so that they can be compared in PHP and then create a query specific to the update?
Or do I still need to replace all editable fields?
This will be a collection containing objects and arrays inside each other, not the simple one shown here.
I know that optimization comes after, but I also want to pick up good habits with MongoDB.
Thank.
source
share