[Solved] Problem on `Mongo Extends: Insert` unknown `document`


I try to use Mongo Extends

import { Mongo } from 'meteor/mongo'
import Schema from './schema'

class AppCollection extends Mongo.Collection {
  insert(document, callback) {
    document.testedBy = 'Theara'
    console.log(document) // undefined

    return super.insert(document, callback)

const Categories = new AppCollection('bg_categories')

export default Categories

Get undefined, when tried to insert doc


Can you post the code where you call insert? Are you passing it a complete object?


Now it work fine :blush:


Sorry but now I have some problem with Meteor.userId() and SimpleSchema (don’t have timestamp field)

document.createdBy = Meteor.userId() // don't work