Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Lists = new Mongo.Collection('lists');
- var Schema = {};
- Schema.Lists = new SimpleSchema({
- name: {
- type: String
- },
- incompleteCount: {
- type: Number
- }
- });
- Lists.attachSchema(Schema.Lists);
- Todos = new Mongo.Collection('todos');
- Schema.Todos = new SimpleSchema({
- listId: {
- type: Object
- },
- text: {
- type: String
- },
- createdAt: {
- type: Date
- }
- });
- Todos.attachSchema(Schema.Todos);
- var timestamp = (new Date()).getTime();
- _.each(data, function(list) {
- var list_id = Lists.insert({name: list.name,
- incompleteCount: list.items.length});
- _.each(list.items, function(text) { //line 43
- Todos.insert({listId: list_id, //line 44
- text: text,
- createdAt: new Date(timestamp)});
- timestamp += 1; // ensure unique timestamp.
- });
- });
- (STDERR) throw(ex);
- (STDERR) ^
- (STDERR) Error: List id must be an object
- (STDERR) at getErrorObject (meteor://💻app/packages/aldeed_collection2-core/lib/collection2.js:345:1)
- (STDERR) at [object Object].doValidate (meteor://💻app/packages/aldeed_collection2-core/lib/collection2.js:328:1)
- (STDERR) at [object Object].Mongo.Collection.(anonymous function) [as insert] (meteor://💻app/packages/aldeed_collection2-core/lib/collection2.js:83:1)
- (STDERR) at meteor://💻app/server/bootstrap.js:44:1
- (STDERR) at Array.forEach (native)
- (STDERR) at Function._.each._.forEach (meteor://💻app/packages/underscore/underscore.js:105:1)
- (STDERR) at meteor://💻app/server/bootstrap.js:43:1
- (STDERR) at Array.forEach (native)
- (STDERR) at Function._.each._.forEach (meteor://💻app/packages/underscore/underscore.js:105:1)
- (STDERR) at meteor://💻app/server/bootstrap.js:39:1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement