Skip to content

Cannot insert document directly from meteor mongodb #27

@msvmsv123

Description

@msvmsv123

I am using the following server side code to test with the C# code provided in the documentation.

/server/main.js

import { Meteor } from 'meteor/meteor';
collection = new Mongo.Collection('collectionName')

Meteor.methods({
  'getStringMethod':function(){
    return "HELLO WORLD"
  }
});

Meteor.publish('subscriptionEndpointName',function(){
  return collection.find()
});

Meteor.startup(() => {
  // code to run on server at startup
});

Then I inserted an empty document in meteor mongodb.

db.collectionName.insert({})

But I got an error in Unity.

NullReferenceException: Object reference not set to an instance of an object
Meteor.Collection`1[main+DocumentType].Meteor.Internal.ICollection.Added (System.String messageText) (at Assets/Meteor-Unity/LiveData/Collection.cs:211)
Meteor.Internal.LiveData.HandleOnTextMessageRecv (System.String socketMessage) (at Assets/Meteor-Unity/LiveData/LiveData.cs:334)
Meteor.Internal.LiveData+<Dispatcher>c__Iterator4.MoveNext () (at Assets/Meteor-Unity/LiveData/LiveData.cs:205)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

There is no problem to insert documents via a meteor method but this error is prompted when I insert documents via meteor mongo directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions