Collection Insert/Update from ServerSide - Fails

Hello
I would like to know how can I insert or update a specific collection from the server side only on startup without client’s interference … I tried so many ways … but still didn’t make it … any advice ?

It would help to tell people what you have tried, and how it failed.

Ok …
I have a collection EmployeesProfiles and it is defined by a simple schema
what i am trying to do at startup
Meteor.startup(function () {
EmployeesProfiles .insert({name:‘abc’});
});

It is not inserting …

Can you clarify this point? Do you see any errors in the server-side console? Does it silently not show up in the database? How did you check this?

well … thanks for your quick reply

the first thing i did is
Meteor.startup(function () {
EmployeesProfiles .insert({name:‘abc’});
});

no insertion with the following error in console

W20160805-23:14:04.743(4)? (STDERR) Error: After filtering out keys not in the schema, your object is now empty
W20160805-23:14:04.743(4)? (STDERR) at [object Object].doValidate (packages/aldeed_collection2-core/lib/collection2.js:374:1)
W20160805-23:14:04.744(4)? (STDERR) at [object Object].Mongo.Collection.(anonymous function) [as insert] (packages/aldeed_collection2-core/lib/collection2.js:173:1)
W20160805-23:14:04.744(4)? (STDERR) at server/init.js:4:31
W20160805-23:14:04.745(4)? (STDERR) at C:\meteor\HR-V2.meteor\local\build\programs\server\boot.js:304:5


but if i use the meteor.methods as follows

Meteor.startup(function () {
Meteor.call(‘insertNewEmployee’, function (err, result) {
});
});

Meteor Methods :
insertNewEmployee: function(id){
EmployeesProfiles .insert({name:‘abc’});
}

no insertion no error

It looks like you might not have defined a name field in your SimpleSchema, and so SimpleSchema is removing it from the inserted object. Could that be the case?

I did define the name field in the schema …
still it is not inserting …
moreover, I dont want to pass by the simpleschema
I just wanna add this new document in that EmployeesProfiles Collection.
Even updating the collection is not working as well and this is a big problem for me …
The full story is that i want every day at 12:00 am to read all the records and update them regardless of the simpleschema and insert a new document… and i am using for that synced-cron
any other suggestion ?

latest updates
I added the name field in the simple schema
and i did set all the optional values to TRUE
It works this way
but the big question is … why do i have to change my schema fields properties to insert a new document … i am asking this coz at the end the document is inserted regardless of the schema layout ?