MongoDb无法填充用户

时间:2018-07-03 02:35:51

标签: database mongodb

嗨,我正在尝试将用户填充到另一个名为feedbackschema的模式中。

反馈架构

No JavaScript engines were registered, falling back to a default config! It is recommended that you configure JavaScriptEngineSwitcher in your app. See https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines for more information.
Error initialising JavaScriptEngineSwitcher.V8.V8JsEngineFactory: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of V8JsEngine error has occurred. 
See more details:

Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
C:\Users\user1\AppData\Local\Temp\Temporary ASP.NET Files\vs\77655ce5\ca0bb6d0\assembly\dl3\300b733a\003cadac_c3f4d201\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\bin\v8-ia32.dll: The specified module could not be found ---> System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
C:\Users\user1\AppData\Local\Temp\Temporary ASP.NET Files\vs\77655ce5\ca0bb6d0\assembly\dl3\300b733a\003cadac_c3f4d201\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\bin\v8-ia32.dll: The specified module could not be found
   at Microsoft.ClearScript.V8.V8Proxy.LoadNativeLibrary()
   at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()
   at Microsoft.ClearScript.V8.V8Proxy.GetAssembly()
   at Microsoft.ClearScript.V8.V8Proxy.GetImplType(Type type)
   at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)
   at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort)
   at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
   at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
   at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
   --- End of inner exception stack trace ---
   at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
   at JavaScriptEngineSwitcher.V8.V8JsEngineFactory.CreateEngine()
   at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)
Error initialising React.VroomJsEngine+Factory: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of VroomJs JavaScript engine error has occurred.    
See more details:

The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.TypeInitializationException: The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'VroomJsNative': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at VroomJs.JsEngine.js_set_object_marshal_type(JsObjectMarshalType objectMarshalType)
   at VroomJs.JsEngine..cctor()
   --- End of inner exception stack trace ---
   at VroomJs.JsEngine..ctor(Int32 maxYoungSpace, Int32 maxOldSpace)
   at React.VroomJsEngine.<>c.<.cctor>b__23_0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at React.VroomJsEngine.get_Engine()
   at React.VroomJsEngine..ctor()
   --- End of inner exception stack trace ---
   at React.VroomJsEngine..ctor()
   at React.VroomJsEngine.Factory.CreateEngine()
   at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)

用户架构

const mongoose = require('mongoose');

const {
  Schema,
} = mongoose;

// Create Schema
const FeedbackSchema = new Schema({
  user: {
    type: Schema.Types.ObjectId,
    ref: 'users',
  },
  pro: {
    type: String,
    required: true,
  },
  con: {
    type: String,
    required: true,
  },
  comments: {
    type: String,
    required: true,
  },
  rating: {
    type: String,
    required: true,
  },
});

// Create model
const feedback = mongoose.model('feedbacks', FeedbackSchema);

module.exports = feedback;

这是我要填充用户的控制器

const mongoose = require('mongoose');

const {
  Schema,
} = mongoose;

// Create Schema
const UserSchema = new Schema({
  name: {
    type: String,
    required: true,
  },
  email: {
    type: String,
    required: true,
    unique: true,
    lowercase: true,
  },
  password: {
    type: String,
    required: true,
  },
  isAdmin: {
    type: Boolean,
    required: true,
    default: false,
  },
});

// Create a model
const user = mongoose.model('users', UserSchema);

// Export the model
module.exports = user;

我通过邮递员收到的杰森是这个

getAllFeedbacks: async (req, res) => {
    const errors = {};
    try {
      const feedbacks = await Feedback.find().populate('user');
      return res.json(feedbacks);
    } catch (err) {
      errors.noFeedbacks = 'Please try again';
      return res.status(404).json(errors);
    }
  },

应该显示用户密钥,但是某种程度上它不起作用。我检查了当前的用户数据已经存在,但是由于某种原因它没有推送用户信息反馈对象。

反馈集合

[
    {
        "_id": "5b3adf88f3c4cd836bdc2eda",
        "pro": "knfklngfdklgnfdgknkln",
        "con": "Sales executive updates",
        "comments": "This is a another funfact for me is me too",
        "rating": "8",
        "__v": 0
    }
]

用户集合

 [
  {
    "_id": {
      "$oid": "5b3adf88f3c4cd836bdc2eda"
    },
    "pro": "knfklngfdklgnfdgknkln",
    "con": "Sales executive updates",
    "comments": "This is a another funfact for me is me too",
    "rating": "8",
    "__v": 0
  }
]

0 个答案:

没有答案