This repository was archived by the owner on Nov 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
This repository was archived by the owner on Nov 6, 2019. It is now read-only.
Collection Already Exists #57
Copy link
Copy link
Open
Description
I am trying to use mubsub in my nodejs application where a user will get notified if he receives a chat message. This is the partial code:
var client = mubsub('mongodb://'+configuration.mongoDBUrl);
var channelConnection = client.channel('connectionstreams');
var channelMessages = client.channel('messagestreams');
var channelSparkTeams = client.channel('sparkteamstreams');
var channelChatMsg = client.channel('chatmsgstreams');
client.on('error', console.error);
channelConnection.on('error', console.error);
channelMessages.on('error', console.error);
channelSparkTeams.on('error', console.error);
channelChatMsg.on('error', console.error);
// --------------- New Chat Message
channelChatMsg.on('document',function(msg){
console.log('Document inserted ->' + msg);
sockets_users.forEach(function(socketUser,i){
socketUser.emit('chat_' + msg.user1_id + "_" + msg.user2_id, msg);
socketUser.emit('chat_' + msg.user2_id + "_" + msg.user1_id, msg);
socketUser.emit('chat_ping_' + msg.user2_id,msg);
});
});
Upon starting the application. I get the Mongodb Error that these collections already exists.
MongoError: a collection 'TestDB.messagestreams' already exists
at toError (g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\utils.js:110:11)
at g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\utils.js:157:55
at g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\db.js:1806:9
at Server.Base._callHandler (g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\connection\base.js:442:41)
at g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\connection\server.js:485:18
at MongoReply.parseBody (g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\responses\mongo_reply.js:68:5)
at .<anonymous> (g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\connection\server.js:443:20)
at emitOne (events.js:96:13)
at emit (events.js:188:7)
at .<anonymous> (g:\xampp\htdocs\skyloop\skyloop_backend_v2\node_modules\mubsub\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:191:13)
name: 'MongoError',
note: 'the autoIndexId option is deprecated and will be removed in a future release',
ok: 0,
errmsg: 'a collection \'TestDB.messagestreams\' already exists',
code: 48,
codeName: 'NamespaceExists' }
Even though i removed them manullay at first. Upon restarting the application I am still getting the error
How do I resolve this error ???
h284611, aleksandrvw and daniel-haigh
Metadata
Metadata
Assignees
Labels
No labels