mongoose-schema

    0熱度

    1回答

    分配,我有以下的MongoDB /貓鼬架構 var forumReplySchema = new Schema({ userid : String, username: String, forumid: {type: String, default: '1'}, message: {type: String, default: ''}, time:

    1熱度

    3回答

    我想模擬以下內容。 我有一個叫做Brick的parent model,它有一些屬性。 將會有5種以上的磚塊都會有自己特定的屬性,這些屬性也是需要的。 我希望以後能夠選擇某個custumer id的所有bricks,無論類型是什麼(TwitterBrick,facebookBrick et cetera)。 var mongoose = require('mongoose'); var Schem

    0熱度

    1回答

    如何在Mongoose模式中描述對象來存儲包含應該被索引的定義屬性的任何屬性? 我有貓鼬模式與結構是這樣的: { a: { type: Object, require: true } } 我不知道對象a所有領域,但我知道它包含字符串b,我應該在創建索引這個領域。 我可以做這樣的事情: { a: { b: { type: String, requir

    1熱度

    1回答

    您可以檢索模型貓鼬像這樣: 提醒用戶= mongoose.model(「用戶」);我想要得到這些模型的關聯數組。 有沒有一些聰明的方法來獲取使用對象解構的模型列表?喜歡的東西: const {User, Employees, Managers} = mongoose.model('x'); 我目前的解決方案是這樣: /project /models index.js 其

    1熱度

    1回答

    我被困在這裏爲發生事件和生日字段中寫入貓鼬模式。我正在使用mongodb/mongoose,並且想要保存事件集合中的類似內容。 { "_id" : ObjectId("5938fc171dfe0f225902d85d"), "month" : 6, "date" : 9, "happenings" : [ { "incident" : "Muhammad, the f

    1熱度

    1回答

    我正在嘗試構建一個適用於大學的MEAN Stack應用程序,我對這個東西很新。我做了一個關於如何實現登錄和註冊的教程。目前,npm start告訴我新模式不是構造函數。我已經找到了答案,但無法真正找到答案。因此,繼承人我的代碼: // imported libraries--------------------- var mongoose = require('mongoose');

    0熱度

    1回答

    所以我有這個方法的模式: UserSchema.methods.comparePassword = (candidatePassword) => { let candidateBuf = Buffer.from(candidatePassword, 'ascii'); if (sodium.crypto_pwhash_str_verify(this.password, cand

    0熱度

    2回答

    我有一個項目模型,它是一個虛擬的領域來引用股票徽章。 'use strict'; const mongoose = require('mongoose'); const mongooseHidden = require('mongoose-hidden')(); const Badge = mongoose.model('Badge'); const validateProperty

    0熱度

    2回答

    字符串數組發現貓鼬的ObjectID我需要找到貓鼬的objectID的指數在一個這樣的數組: [ { _id: 58676b0a27b3782b92066ab6, score: 0 }, { _id: 58676aca27b3782b92066ab4, score: 3 }, { _id: 58676aef27b3782b92066ab5, score: 0 }] 我使用比

    1熱度

    1回答

    我的查詢,如下圖所示: orderSubInfo.find({ 'order_id': { $in: orderArray } }).populate({ path: 'order_id', populate: { path: 'foodtruck_id', model: 'foodtruck' } }).e