I'm trying to retrieve all the documents from a collection stored in azure cosmos db.
However , after the query i get the below error
"MongoError: Command is not supported
at I:\xxxxx\bot\node_modules\mongodb-core\lib\cursor.js:771:34
at handleCallback (I:\xxxxx\bot\node_modules\mongodb-core\lib\cursor.js:178:5)
at setCursorDeadAndNotified (I:\xxx\bot\node_modules\mongodb-core\lib\cursor.js:545:3)
at nextFunction (I:\xxxxx\bot\node_modules\mongodb-core\lib\cursor.js:770:14)
at I:\xxxxx\bot\node_modules\mongodb-core\lib\cursor.js:667:7
at queryCallback (I:\xxxx\bot\node_modules\mongodb-core\lib\cursor.js:263:5)
at I:\xxxxx\bot\node_modules\mongodb-core\lib\connection\pool.js:541:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)"
It looks like the cursor is sending this when i'm trying to convert the docs to an array toArray()
heres my function thats trying to retrieve the docs
var getQuestions = function(){
return new Promise((resolve, reject) => {
const questionDB = state.db.db('admin')
const program = questionDB.collection('Version')
program.find().toArray()
.then(function(docs){
console.log('docs : ', docs)
})
.catch(function(err){
console.log('err : ', err)
})
})
}
Am i doing something wrong?