Realm Functions execution result type differ for the same versions

Hi, I have two MongoDB Realm apps that have the same versions but when I execute something in a function the returned object types differ.


Atlas: 4.4.10
Server Version: 4ab8d0db70
UI Version: 4.37.4
JS SDK Version: 3.18.0


const db ="mongodb-atlas").db("divtracker");
const transactionsCollection = db.collection("transactions");
const promise = transactionsCollection.find({}).toArray();
console.log(`Promise: ${JSON.stringify(promise)}`);

According to the documentation promise should be a Promise. That’s true for one of my Realm apps but for another, the actual result is an array. The question is: what’s going on? :rofl:

Expected result:

Promise: {}

Actual result:

Promise: [{...},{...},...]

The reason was the configuration file data_sources/mongodb-atlas/config.json. If there is a "version": 1 line then Promise is returned :exploding_head:. I didn’t find anything on the UI to adjust this setting but I’m glad that I was able to dig to the root cause so fast

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.