Meteor.js persistent + memory Mongo - mongodb

It's possible to connect meteor manually to 2 or more databases in order to have a normal mongo that saves to the disk and a memory one like redis?
I'm asking because mongo has already full support from meteor and using it would be a lot easier than redis or other database

Right now, a Meteor server can only connect to one (and exactly one) Mongo database.
Redis support is on the roadmap, as is SQL support. Once Meteor supports multiple databases, you will have more options for how to set up your databases as well as dividing up your data between them. The only way to do what you are saying right now is to have your Meteor client connect to two different Meteor servers, and have one of them clear/dump the database regularly.
Source: discussions at Meteor's offices.

Related

How to transfer a database from MongoDB Compass to MongoDB Atlas

I have an existing database for a discord bot in MongoDB Compass v1.28.1 I want to transfer all the data in the database to mongodb atlas because of its more extensive functionality and to not have to wait for compass to take ages to load each time I open it. However when I follow the steps to connect that are provided in Atlas, the pop-up that's supposed to appear when I copy a path to the clipboard doesn't appear, and nothing happens. I tried to connect through my app in VSCode, the same way I did for Compass, using mongoose. Still no collections are loading or any data being stored. I have made my schemas etc. which work perfectly fine in Compass...
Migration to Atlas is documented at https://docs.atlas.mongodb.com/import/
To save you some reads, you have to options - export/import and mongodump/mongorestore.
I would recommend to try export/import first. It's built into Compass https://docs.mongodb.com/compass/current/import-export/ and must be simpler to use considering limited experience with mongo. It's UI oriented so just follow the click-through guide in the documentation.
Unfortunately it has some limitations related to data type conversion from BSON to JSON and may be a bit tedious if you have large number of collections.
In this case you will need to follow CLI mongodump/mongorestore way #barrypicker suggested in the comments. Both commands are available in cmd and PowerShell consoles.
First you backup your local database https://docs.mongodb.com/v4.2/reference/program/mongodump/:
mongodump --uri="mongodb://username:password#localhost:27017/discordbot"
username and password are the ones you use in compass to connect to the source database.
It will create dump directory with all collections you have.
Then you have to upload the backup to Atlas:
mongorestore --uri="mongodb+srv://username:password#cluster.tenant.mongodb.net/database" dump/
username and password are the ones you use to connect to atlas cluster, listed in the "Security/Database Access" section.
You can get the exact subdomains for the --uri part from Atlas. In the dashboard click "Connect" button for the cluster you want to connect to, then choose "shell" as the connection method in the connection pop-up:

connect to documentdb using robomongo

I have a Document DB (using the DocumentDB interface, NOT the MongoDb interface), so the connection string looks like:
AccountEndpoint=https://SomeDatabase.documents.azure.com:443/;AccountKey=xxxxx;
it does NOT look like this:
mongodb://SomeDatabase:xxxxx==#SomeDatabase.documents.azure.com:10255/?ssl=true&replicaSet=globaldb
Question:
How do I connect using RoboMongo or other MongoDb tools/code?
The stuff I looked at said things like take the username (that it shows in the MongoDb version of Cosmos DB (which won't help, as it is a totally different database and the connection string there won't work for apps that need the DocumentDb interface)
Is there a way to do this,or by 'adding support for MongoDB interface to Document DB' like adding the ability to talk to a Ms-SQL Server using MongoDB because you can always download MongoDb an install that on the same machine. (and not be able to get any data passed between them)
When you use Cosmos DB, you must choose, for your deployed database, which API to use with it (DocumentDB, MongoDB, Tables, Gremlin). You cannot use multiple APIs against the same database.
The only way to use MongoDB tools & frameworks is to deploy a Cosmos DB database with the MongoDB API. The MongoDB API is what provides compatibility with MongoDB. Note: The oplog is not provided with the Cosmos MongoDB API, so tools that rely on reading/tailing the oplog will not work.
The DocumentDB API does not surface any of the MongoDB API, so you will not be able to use MongoDB-specific tools when deploying a DocumentDB-specific database.
Note: The MongoDB API of Cosmos does not surface an oplog, so any operations which attempt to query the oplog will not succeed.
Have you seen this how-to by Microsoft for this: Use Robomongo with an Azure Cosmos DB
And one more related: Connecting to Azure Cosmos DB emulator from RoboMongo

Connecting MongoDB instance (on Compose) directly to MongoDB on Bluemix

I am looking for a Tool or Tool Set that can connect a MongoDB instance (on Compose) directly to MongoDB on Bluemix to extract / and move data from a MongoDB database on compose.com to a MongoDB database on Bluemix Public.
Is there a way to do this i.e. are there any known best practices to solve the problem?
I'd take a look at using mongodump and mongorestore: https://help.compose.com/docs/mongodb-tools#using-mongodump-and-mongorestore
I know you mention "directly" (as in no middle man) but I don't think that's currently possible (e.g. copydb is not an option in these managed instances).

Meteor - unmount existing mongo collection

We are creating Meteor-based Mongo database manager and we need the ability to "unmount" (remove from system) all collections when we switch databases.
Example:
I'm managing database called dbA. We have all collections for that database created using Mongo.Collection() on server and on client side.
I want to switch database to dbB. I need to unmount all Collections of dbA and mount those of dbB. Reason: dbB could have a collection of the same name as dbA (and usually does)
Is there a way to do this?
Thanks!
You may be able to accomplish this by publishing the necessary data from the new database.
Here's a discussion from a similar question on the Meteor Forums (note the proposed solution at the end):
https://forums.meteor.com/t/switch-database-while-meteor-is-running/4361/5
hi i think you can do with
db.copyDatabase()
run the shell command in the backend from meteor server and execute the copy database command. and after the database is copied you can remove the previous collection.
more detail about copyDatabase() is here
https://docs.mongodb.org/manual/reference/method/db.copyDatabase/

Feasible to install mongo-connector on separate server from mongo databases?

Does anyone know if its more feasible to install mongo-connector on its own server or to just have it running on one of the mongo database servers? I currently have it running on a secondary mongo server and want to move it off the secondary server but I am not sure if it really matters.
Mongo Connector is just another client application connecting to your MongoDB server. You can install it wherever you like, as long as it is able to connect to your MongoDB server and whatever external system you're trying to feed data to.
Note: If Mongo Connector is matching a comparatively small selection of data in the replication oplog to insert into your external system, it would make sense to keep this on the same secondary or node whose oplog is being monitored. Otherwise the Connector will be pulling the full oplog over the network, which may consume unnecessary bandwidth.