在 meteor 中找不到方法 "Astronomy/execute"

Method "Astronomy/execute" not found in meteor

好的,我使用 meteor 中的天文包构建游戏数据库模式。

然后我尝试通过在服务器中扩展它来向它添加方法。 (server/gamehandle.js)

import {Game} from '../imports/db/game'
import {DDP} from 'meteor/ddp-client'

Game.extend({
  meteorMethods: {
    AddNewGame(judul){
      const invocation = DDP._CurrentInvocation.get()
      this.namaGame = judul
      this.creator = invocation.userId
      this.createdAt = new Date()
      return this.save()
    }
  }
})

但是当我尝试使用 callMethod 运行 应用程序客户端中的方法时,它会抛出 astronomy/execute 未找到 404 错误。 这是使用它的组件

import {Game} from '../../../db/game'

export function NewGameList(props){
  const { isOpen, onOpen, onClose } = useDisclosure()
  const [judul, setJudul] = useState('')
  const [hasil, setHasil] = useState(null)
  const judulChange = (e) => setJudul(e.target.value)
  const AddGame = new Game()
  
  const handleSubmit = (e) => {
    e.preventDefault()
    AddGame.callMethod('AddNewGame', judul, (err, result) => {
      result ? setHasil(result) : setHasil(err.message) 
      console.log(err)
    })
  }
...

请赐教,我哪里做错了?

终于从 meteor slack 找到了解决方案。 只需要将我的 db 文件导入服务器中的主 js 文件。