Change all instances of Meteor.Collection for Mongo.Collection (#6410)

* Change all instances of Meteor.Collection for Mongo.Collection
http://stackoverflow.com/questions/25756664/is-it-mongo-collection-or-meteor-collection

* Include api.use(‘mongo’) where it was missing
pull/6430/head
Marcelo Schmidt 9 years ago committed by Rodrigo Nascimento
parent 53440479a5
commit f98507dc68
  1. 2
      packages/rocketchat-authorization/client/lib/models/Roles.js
  2. 3
      packages/rocketchat-channel-settings-mail-messages/package.js
  3. 4
      packages/rocketchat-integrations/client/collections.js
  4. 1
      packages/rocketchat-integrations/package.js
  5. 2
      packages/rocketchat-lib/client/lib/cachedCollection.js
  6. 4
      packages/rocketchat-lib/tests/jasmine/server/unit/models/_Base.spec.coffee
  7. 4
      packages/rocketchat-livechat/app/client/lib/collections.coffee
  8. 2
      packages/rocketchat-logger/client/viewLogs.coffee
  9. 2
      packages/rocketchat-logger/logger.coffee
  10. 1
      packages/rocketchat-logger/package.js
  11. 2
      packages/rocketchat-mentions-flextab/client/lib/MentionedMessage.coffee
  12. 1
      packages/rocketchat-mentions-flextab/package.js
  13. 2
      packages/rocketchat-message-pin/client/lib/PinnedMessage.coffee
  14. 1
      packages/rocketchat-message-pin/package.js
  15. 2
      packages/rocketchat-message-snippet/client/lib/collections.js
  16. 1
      packages/rocketchat-message-snippet/package.js
  17. 2
      packages/rocketchat-message-star/client/lib/StarredMessage.coffee
  18. 1
      packages/rocketchat-message-star/package.js
  19. 2
      packages/rocketchat-oauth2-server-config/admin/client/collection.coffee
  20. 2
      packages/rocketchat-oauth2-server-config/oauth/client/oauth2-client.coffee
  21. 1
      packages/rocketchat-oauth2-server-config/package.js
  22. 2
      packages/rocketchat-ui-admin/client/admin.coffee
  23. 2
      packages/rocketchat-ui-admin/client/rooms/adminRooms.coffee
  24. 1
      packages/rocketchat-ui-admin/package.js
  25. 10
      server/startup/migrations/v009.js
  26. 16
      server/startup/migrations/v015.js

@ -1,4 +1,4 @@
RocketChat.models.Roles = new Meteor.Collection('rocketchat_roles');
RocketChat.models.Roles = new Mongo.Collection('rocketchat_roles');
Object.assign(RocketChat.models.Roles, {
findUsersInRole(name, scope, options) {

@ -13,7 +13,8 @@ Package.onUse(function(api) {
'reactive-var',
'less',
'rocketchat:lib',
'rocketchat:channel-settings'
'rocketchat:channel-settings',
'mongo'
]);
api.addFiles([

@ -1,2 +1,2 @@
this.ChatIntegrations = new Meteor.Collection('rocketchat_integrations');
this.ChatIntegrationHistory = new Meteor.Collection('rocketchat_integration_history');
this.ChatIntegrations = new Mongo.Collection('rocketchat_integrations');
this.ChatIntegrationHistory = new Mongo.Collection('rocketchat_integration_history');

@ -7,6 +7,7 @@ Package.describe({
});
Package.onUse(function(api) {
api.use('mongo');
api.use('coffeescript');
api.use('underscore');
api.use('ecmascript');

@ -101,7 +101,7 @@ class CachedCollection {
version = 6,
maxCacheTime = 60*60*24*30
}) {
this.collection = collection || new Meteor.Collection(null);
this.collection = collection || new Mongo.Collection(null);
this.ready = new ReactiveVar(false);
this.name = name;

@ -13,12 +13,12 @@ describe 'rocketchat:lib Server | Models | Base', ->
it 'should provide a basename for collections', ->
expect(typeof this.obj._baseName()).toBe('string')
it 'should carry a Meteor.Collection object when initialized', ->
it 'should carry a Mongo.Collection object when initialized', ->
expect(this.obj.model).toBeFalsy()
expect(this.obj._initModel('carry')).toBeTruthy()
expect(typeof this.obj.model).toBe('object')
it 'should apply a basename to the Meteor.Collection created', ->
it 'should apply a basename to the Mongo.Collection created', ->
name = 'apply'
expect(this.obj._initModel(name)).toBeTruthy()
expect(this.obj.model._name).toBe(this.obj._baseName() + name)

@ -1,2 +1,2 @@
@ChatMessage = new Meteor.Collection null
@Department = new Meteor.Collection null
@ChatMessage = new Mongo.Collection null
@Department = new Mongo.Collection null

@ -1,4 +1,4 @@
@stdout = new Meteor.Collection 'stdout'
@stdout = new Mongo.Collection 'stdout'
Meteor.startup ->
RocketChat.AdminBox.addOption

@ -64,7 +64,7 @@ Template.prototype.onCreated = wrapLifeCycle Template.prototype.onCreated, 'onCr
Template.prototype.onRendered = wrapLifeCycle Template.prototype.onRendered, 'onRendered', 'green'
Template.prototype.onDestroyed = wrapLifeCycle Template.prototype.onDestroyed, 'onDestroyed', 'red'
# stdout = new Meteor.Collection 'stdout'
# stdout = new Mongo.Collection 'stdout'
# Meteor.subscribe 'stdout'

@ -5,6 +5,7 @@ Package.describe({
});
Package.onUse(function(api) {
api.use('mongo');
api.use('ecmascript');
api.use('coffeescript');
api.use('underscore');

@ -1 +1 @@
@MentionedMessage = new Meteor.Collection 'rocketchat_mentioned_message'
@MentionedMessage = new Mongo.Collection 'rocketchat_mentioned_message'

@ -7,6 +7,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'mongo',
'ecmascript',
'coffeescript',
'underscore',

@ -1 +1 @@
@PinnedMessage = new Meteor.Collection 'rocketchat_pinned_message'
@PinnedMessage = new Mongo.Collection 'rocketchat_pinned_message'

@ -6,6 +6,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'mongo',
'coffeescript',
'ecmascript',
'underscore',

@ -1 +1 @@
this.SnippetedMessages = new Meteor.Collection('rocketchat_snippeted_message');
this.SnippetedMessages = new Mongo.Collection('rocketchat_snippeted_message');

@ -8,6 +8,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'mongo',
'ecmascript',
'rocketchat:lib',
'rocketchat:file',

@ -1 +1 @@
@StarredMessage = new Meteor.Collection 'rocketchat_starred_message'
@StarredMessage = new Mongo.Collection 'rocketchat_starred_message'

@ -7,6 +7,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'mongo',
'coffeescript',
'ecmascript',
'underscore',

@ -1 +1 @@
@ChatOAuthApps = new Meteor.Collection 'rocketchat_oauth_apps'
@ChatOAuthApps = new Mongo.Collection 'rocketchat_oauth_apps'

@ -1,4 +1,4 @@
# @ChatOAuthApps = new Meteor.Collection 'rocketchat_oauth_apps'
# @ChatOAuthApps = new Mongo.Collection 'rocketchat_oauth_apps'
FlowRouter.route '/oauth/authorize',
action: (params, queryParams) ->

@ -7,6 +7,7 @@ Package.describe({
Package.onUse(function(api) {
api.use('webapp');
api.use('coffeescript');
api.use('mongo');
api.use('ecmascript');
api.use('rocketchat:lib');
api.use('rocketchat:api');

@ -1,5 +1,5 @@
import toastr from 'toastr'
TempSettings = new Meteor.Collection null
TempSettings = new Mongo.Collection null
RocketChat.TempSettings = TempSettings
getDefaultSetting = (settingId) ->

@ -1,4 +1,4 @@
@AdminChatRoom = new Meteor.Collection('rocketchat_room')
@AdminChatRoom = new Mongo.Collection('rocketchat_room')
Template.adminRooms.helpers
isReady: ->

@ -12,6 +12,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'mongo',
'ecmascript',
'templating',
'coffeescript',

@ -6,20 +6,20 @@ RocketChat.Migrations.add({
// source collection is dropped after data migration
const toMigrate = [
{
source: new Meteor.Collection('data.ChatRoom'),
source: new Mongo.Collection('data.ChatRoom'),
target: RocketChat.models.Rooms.model
}, {
source: new Meteor.Collection('data.ChatSubscription'),
source: new Mongo.Collection('data.ChatSubscription'),
target: RocketChat.models.Subscriptions.model
}, {
source: new Meteor.Collection('data.ChatMessage'),
source: new Mongo.Collection('data.ChatMessage'),
target: RocketChat.models.Messages.model
}, {
source: new Meteor.Collection('settings'),
source: new Mongo.Collection('settings'),
target: RocketChat.models.Settings.model
}, {
// this collection may not exit
source: new Meteor.Collection('oembed_cache'),
source: new Mongo.Collection('oembed_cache'),
target: RocketChat.models.OEmbedCache.model
}
];

@ -2,12 +2,12 @@ RocketChat.Migrations.add({
version: 15,
up() {
console.log('Starting file migration');
const oldFilesCollection = new Meteor.Collection('cfs.Files.filerecord');
const oldGridFSCollection = new Meteor.Collection('cfs_gridfs.files.files');
const oldChunkCollection = new Meteor.Collection('cfs_gridfs.files.chunks');
const oldFilesCollection = new Mongo.Collection('cfs.Files.filerecord');
const oldGridFSCollection = new Mongo.Collection('cfs_gridfs.files.files');
const oldChunkCollection = new Mongo.Collection('cfs_gridfs.files.chunks');
const newFilesCollection = RocketChat.models.Uploads;
const newGridFSCollection = new Meteor.Collection('rocketchat_uploads.files');
const newChunkCollection = new Meteor.Collection('rocketchat_uploads.chunks');
const newGridFSCollection = new Mongo.Collection('rocketchat_uploads.files');
const newChunkCollection = new Mongo.Collection('rocketchat_uploads.chunks');
oldFilesCollection.find({
'copies.files.key': {
@ -42,7 +42,7 @@ RocketChat.Migrations.add({
newFilesCollection.insert(record);
const oldGridFsFile = oldGridFSCollection.findOne({
_id: new Meteor.Collection.ObjectID(cfsRecord.copies.files.key)
_id: new Mongo.Collection.ObjectID(cfsRecord.copies.files.key)
});
newGridFSCollection.insert({
@ -58,7 +58,7 @@ RocketChat.Migrations.add({
});
oldChunkCollection.find({
files_id: new Meteor.Collection.ObjectID(cfsRecord.copies.files.key)
files_id: new Mongo.Collection.ObjectID(cfsRecord.copies.files.key)
}).forEach((oldChunk) => {
newChunkCollection.insert({
_id: oldChunk._id,
@ -96,7 +96,7 @@ RocketChat.Migrations.add({
oldFilesCollection.remove({_id: cfsRecord._id});
oldGridFSCollection.remove({_id: oldGridFsFile._id});
oldChunkCollection.remove({files_id: new Meteor.Collection.ObjectID(cfsRecord.copies.files.key)});
oldChunkCollection.remove({files_id: new Mongo.Collection.ObjectID(cfsRecord.copies.files.key)});
});
return console.log('End of file migration');

Loading…
Cancel
Save