Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema

Home Page:https://github.com/Meteor-Community-Packages/meteor-simple-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bulk insert

haojia321 opened this issue · comments

Will simple schema still work if I use bulk insert? https://docs.mongodb.com/manual/reference/method/Bulk.insert/#Bulk.insert

We need to write below code to achieve Mongodb's bulk insert
var bulk = UserNotifications.rawCollection().initializeUnorderedBulkOp();
...
bulk.execute();

No, you'll need to validate all docs before inserting

Hi @aldeed,
Yes, thats what we are doing now. We use check(obj, collection.simpleschema()); to check if obj is valid.

So if I have autoValue been set in simpleschema, do you know if their is a way I can programmatically generate the autoValue before use check()?