小编S.S*_*lan的帖子

如何使用 Mongoose 在 mongoDB 中的 3 个集合中填充

我有三个集合,例如UserProgram和`议程。这些模型如下。

用户模型

const mongoose = require('mongoose');

const UserSchema = mongoose.Schema({
    name: {type:String},
    email: {type:String}
},{timestamps:true
}
);

module.exports = mongoose.model('User', UserSchema);
Run Code Online (Sandbox Code Playgroud)

程序模型

const mongoose = require('mongoose');

const NoteSchema = mongoose.Schema({
    name: {type:String},
    timefrom: {type:Date},
    timeto: {type:Date},
    status: {type:String},
    venue: {type:String},
    timetype: {type:Number},
    userid:{type:mongoose.Schema.Types.ObjectId,ref : 'User', required: true},
    logo :{type:String,default: 'programe'}
},{timestamps:true
});

module.exports = mongoose.model('Program', NoteSchema);
Run Code Online (Sandbox Code Playgroud)

议程模型

const mongoose = require('mongoose');

const AgendaSchema = mongoose.Schema({
    name: {type:String},
    timefrom: {type:Date},
    timeto: {type:Date},
    status: {type:String},
    proorder: {type:String},
    proid:{type:mongoose.Schema.Types.ObjectId,ref …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js mongodb-query aggregation-framework

7
推荐指数
1
解决办法
4258
查看次数

Pascal 编程中的步长值

我想要一个编程代码来打印范围之间的奇数来教学生。这里我取范围为1到10。所以我想打印1到10之间的奇数。

我编写此代码是为了打印 1 到 10 之间的奇数

program printOdd1to10; {Prints odd numbers 1 - 10}

var counter : integer;
begin

   for counter := 1 to 10 do

      begin
        Writeln(counter); {prints new line}
        counter := counter + 2 {increment by value 2, like step 2}
      end;
        Readln;

end.
Run Code Online (Sandbox Code Playgroud)

但是当我运行时,它会打印出一长串错误答案。那么,如何在 Pascal 编程中打印这样的模式:奇数、偶数、3(3,6,9...) 次数字。

pascal

4
推荐指数
1
解决办法
8054
查看次数