The MongoDB Stitch Documentation is showing an example where we use also the RemoteMongoClient, but do we really need this client when working only with GrapohQL for querying and mutating data?
Here the example:
const {
Stitch,
RemoteMongoClient,
AnonymousCredential
} = require('mongodb-stitch-browser-sdk');
const client = Stitch.initializeDefaultAppClient('weblocu-axibm');
const db = client.getServiceClient(RemoteMongoClient.factory, 'mongodb-atlas').db('<DATABASE>');
client.auth.loginWithCredential(new AnonymousCredential()).then(user =>
db.collection('<COLLECTION>').updateOne({owner_id: client.auth.user.id}, {$set:{number:42}}, {upsert:true})
).then(() =>
db.collection('<COLLECTION>').find({owner_id: client.auth.user.id}, { limit: 100}).asArray()
).then(docs => {
console.log("Found docs", docs)
console.log("[MongoDB Stitch] Connected to Stitch")
}).catch(err => {
console.error(err)
});