Hi!
I have some documents that contain a property of embedded documents. This doesn’t scale well linearly as an update to the Parent Doc can take a minute on localhost alone. (This is with 250+ embedded docs and each has about 6 properties each).
Wasn’t the right choice for our data, but documents this large don’t appear frequently either. Rather, than redesign the schema, was wondering if there was a short-term solution for enhancing speed and performance of DB Hits on a large document.
I could omit saving the property that contains the embedded documents. It doesn’t even need to be done in this use case and I can do it by modifying the assignments in the $set
with some conditional…i.e. (updateEmbeddedDocs
boolean)
Update: Looks like much of the slowdown is happening with a SimpleSchema clean
call. And it trying to clean the huge parent Doc. https://github.com/aldeed/meteor-simple-schema/issues/685 Any solutions to using this? Removing the clean
isn’t an option. Perhaps omitting it for the embedded docs will work though.
The functionality only has to update 1 property at a time.
So something like
const update = {
"$set" : {}
};
update["$set"][property] = value;
LineItems.update({_id:id},update);
should be literally all I need (as opposed to updating the whole large document).
So all I really need now is just a way to clean
just value
for property
. I cannot find anything in SimpleSchema that allows me to do that yet. Looks like it’ll just clean the whole Doc. Any ideas? Thanks