无法通过猫鼬查询Azure Cosmos Db模拟器

时间:2018-12-07 09:46:07

标签: azure azure-cosmosdb azure-cosmosdb-mongoapi

我是Cosmos Db的新手。当我尝试通过猫鼬查询Azure Cosmos db模拟器时,我得到了null。但是,如果我查询Azure上托管的Cosmos Db,则一切正常。我不知道我的代码有什么问题。知道可能是什么问题以及如何解决这个问题

enter image description here

这是我的代码

var mongoose = require('mongoose');
var schema = mongoose.Schema(
    {
        "id": String,
        "status": String,
        "owner": String,
        "sn": String
    }

);
schema.set('toJSON', {
    virtuals: true,
    transform: (doc, ret, options) => {
        delete ret.__v;
        delete ret._id;
    },
});
module.exports = mongoose.model('projects', schema);

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:10255/picassoData?ssl=true',  
    { 
        useNewUrlParser: true,
        auth: {
            user: "localhost",
            password: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
          }
    });

var Projects = require('./project');
var x = await Projects.findOne({id: "123"}).exec();

0 个答案:

没有答案