hwillson / meteor-stub-collections

Stub out Meteor collections with in-memory local collections.
MIT License
24 stars 17 forks source link

when stubbing a collection with a schema defined, the insert "succeeds" but the record isn't created #25

Open znewsham opened 6 years ago

znewsham commented 6 years ago

As the title says, no error is thrown (sync or async) an _id is returned, but the record isn't actually created.

znewsham commented 6 years ago

It seems that this is worse than I thought, I can't get any collection to stub correctly (on the server, not sure about client):

            import StubCollections from 'meteor/hwillson:stub-collections';
            var test = new Mongo.Collection("test");
            StubCollections.stub([test]);
            test.insert({test: "test"});
            console.log(test.findOne());//logs undefined
spinualexandru commented 6 years ago

+1

hwillson commented 5 years ago

@znewsham Any chance you could link to a small runnable reproduction that demonstrates this?

znewsham commented 5 years ago

@hwillson I actually can't - I guess it has something to do with the other packages I'm using. I've tried adding the usual culprits (collections2, simple schema, hooks, etc) - but can't get this to repeat. I'm in the process of updating my meteor apps to 1.7, once I'm done doing that I'll confirm if this still exists.

SimonSimCity commented 5 years ago

I had this when using another package which has lai:collection-extensions or another package, replacing the Mongo.Collection constructor.