Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot insert document directly from meteor mongodb #27

Open
msvmsv123 opened this issue Jun 12, 2017 · 1 comment
Open

Cannot insert document directly from meteor mongodb #27

msvmsv123 opened this issue Jun 12, 2017 · 1 comment

Comments

@msvmsv123
Copy link

msvmsv123 commented Jun 12, 2017

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.

@msvmsv123 msvmsv123 changed the title Request for adding Meteor server side and MongoDB code example to the documentation Cannot insert document directly from meteor mongodb Jun 12, 2017
@msvmsv123
Copy link
Author

After inserting the first document via meteor method, inserting documents via meteor mongodb is also ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant