mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Handled implicit collection creation oplog message (fixes #12627).
This commit is contained in:
@@ -308,6 +308,9 @@ Object.assign(OplogHandle.prototype, {
|
||||
trigger.collection = doc.o.drop;
|
||||
trigger.dropCollection = true;
|
||||
trigger.id = null;
|
||||
} else if ("create" in doc.o && "idIndex" in doc.o) {
|
||||
// A collection got implicitly created within a transaction. There's
|
||||
// no need to do anything about it.
|
||||
} else {
|
||||
throw Error("Unknown command " + EJSON.stringify(doc));
|
||||
}
|
||||
|
||||
@@ -164,6 +164,21 @@ process.env.MONGO_OPLOG_URL && testAsyncMulti(
|
||||
]
|
||||
);
|
||||
|
||||
import { Mongo, MongoInternals } from 'meteor/mongo';
|
||||
process.env.MONGO_OPLOG_URL && Tinytest.addAsync(
|
||||
'mongo-livedata - oplog - x - implicit collection creation',
|
||||
async test => {
|
||||
const collection = new Mongo.Collection(`oplog-implicit-${test.runId()}`);
|
||||
const { client } = MongoInternals.defaultRemoteCollectionDriver().mongo;
|
||||
test.equal(await collection.find().countAsync(), 0);
|
||||
await client.withSession(async session => {
|
||||
await session.withTransaction(async () => {
|
||||
await collection.rawCollection().insertOne({}, { session });
|
||||
});
|
||||
});
|
||||
test.equal(await collection.find().countAsync(), 1);
|
||||
},
|
||||
);
|
||||
|
||||
// Meteor.isServer && Tinytest.addAsync(
|
||||
// "mongo-livedata - oplog - _onFailover",
|
||||
|
||||
Reference in New Issue
Block a user