diff --git a/packages/mongo/collection/collection.js b/packages/mongo/collection/collection.js index ec2e3323b7..5cbe19af57 100644 --- a/packages/mongo/collection/collection.js +++ b/packages/mongo/collection/collection.js @@ -11,7 +11,6 @@ import { validateCollectionName } from './collection_utils'; import { ReplicationMethods } from './methods_replication'; -import { watchChangeStream } from './watch_change_stream'; /** * @summary Namespace for MongoDB-related items @@ -268,6 +267,3 @@ Meteor.Collection = Mongo.Collection; // Allow deny stuff is now in the allow-deny package Object.assign(Mongo.Collection.prototype, AllowDeny.CollectionPrototype); -// Só agora que Mongo.Collection existe, adicionamos o método ao prototype -Object.assign(Mongo.Collection.prototype, { watchChangeStream }); - diff --git a/packages/mongo/collection/watch_change_stream.js b/packages/mongo/collection/watch_change_stream.js deleted file mode 100644 index a4e8ae7b95..0000000000 --- a/packages/mongo/collection/watch_change_stream.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @summary Watches the MongoDB collection using Change Streams. - * @locus Server - * @memberof Mongo.Collection - * @instance - * @param {Array} [pipeline] Optional aggregation pipeline to filter Change Stream events. - * @param {Object} [options] Optional settings for the Change Stream. - * @returns {ChangeStream} The MongoDB ChangeStream instance. - * @throws {Error} If called on a client/minimongo collection. - * - * @example - * const changeStream = MyCollection.watchChangeStream([ - * { $match: { 'operationType': 'insert' } } - * ]); - * changeStream.on('change', (change) => { - * console.log('Change detected:', change); - * }); - */ - -export function watchChangeStream(pipeline = [], options = {}) { - // Only available on server - if (typeof Package === 'undefined' || !this.rawCollection) { - throw new Error('watchChangeStream is only available on server collections'); - } - const raw = this.rawCollection(); - if (!raw.watch) { - throw new Error('Underlying collection does not support watch (Change Streams)'); - } - console.log('[watchChangeStream] Chamando raw.watch() com pipeline:', JSON.stringify(pipeline, null, 2), 'e options:', JSON.stringify(options, null, 2)); - return raw.watch(pipeline, options); -}