I’m not sure what exactly the problem is caused by here… A reproduction or maybe even just your schema definition could go a long way to help.
Beyond That…
If the issue you are facing is truly the one specified there, then I would recommend flattening your schema a bit by denormalizing your data. Seeing the output of the one case to the console, I don’t think this is the problem.
Lastly
You might try using models for these types of operations. Here is an example using BaseModel from socialize:base-model
import { Mongo } from 'meteor/mongo';
import { BaseModel } from 'meteor/socialize:base-model';
import SimpleSchema from 'simpl-schema';
const Cases = new Mongo.Collection('cases');
const CaseSchema = new SimpleSchema({
caseStatus: {
type: String,
label: 'Case Status'
optional: true,
defaultValue: "open",
},
// The rest of your schema definition here
});
Cases.attachSchema(CaseSchema);
export class Case extends BaseModel {
// methods can go here, but are optional
}
Case.attachCollection(Cases);
Once you have your new Case class then you can use it’s methods to manipulate your data…
// Get a case, an instance of Case class will be returned here
const case = Cases.findOne();
// Modify the fields you wish to update here
case.caseStatus = 'closed';
case.content = 'This is a test of case content';
// Now we just save the case by calling it's save() method
case.save();
Yes, the returning of models from find/findOne and the save method attached to that model is functionality provided by extending the BaseModel class. There are other packages that provide similar functionality, but I’m obviously very biased .
You’re right to be biased. It’s a much more simplified approach to collections. Why isn’t autoform and your base package… standard?
Seriously. It should be out of the box.
I took a crack at installing it, but failed, need to mess with some stuff and I will implement over the weekend.
My new launch is https://FaverCRM.com – I have a client meeting next Monday, I’ll sign your Patreon when my client jumps on board. You’re doing Gods work.
The simple answer to this is choice… There are other packages out there to choose from and I’m personally happy to not be locked into any one of them… I personally chose to build my preferred workflow around other packages like simpl-schema/collection2/collection-hooks/publish-composite but there is also Astronomy which is an all in one solution that does the same things just put into a single package.