For the moment I’ve tried this using MongoDB Compass 1.39.3, mongosh 1.10.6 and Node.js driver v6.0.0 and performed the following:
- Connect to serverless instance via Compass
- Create new collection
- Insert 5 documents
- Create index
- Connect to serverless cluster via mongosh
- Verify index exists
- Try filtering for 1 document and generating an explain plan to verify the index is used (it is)
- Create a Node.js script to validate the same operation uses the index (it does)
At the moment everything appear to be working as expected. If it helps the script I used in Node is:
const { MongoClient } = require("mongodb");
const client = new MongoClient("mongodb+srv://xyz.mongodb.net/");
async function run() {
try {
await client.connect();
const database = client.db("test");
const coll = database.collection("amplify");
var result = await coll.find({ amplify_id: 1 }).explain();
console.log(result);
} finally {
await client.close();
}
process.exit(0);
}
run().catch(console.dir);