我的passport.js配置是这样的:
const Local = require("passport-local").Strategy;
const USMODEL = require("../models/user.js");
passport.serializeUser(function(user, done) {
console.log("SERIALIZING USER");
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
console.log("DESUSER", id);
var US = mongoose.model("RegUser", USMODEL);
US.findById(id, function(err, user) {
done(err, id);
});
});
passport.use("local-login", new Local({
usernameField: "email",
passwordField: "password",
passReqToCallback: true
},function(req, email, password, done) {
var US = mongoose.model("RegUser", USMODEL);
US.findOne({"email": email}, function(err, user){
if(err) throw err;
if(!user) return done(null, false);
if(!user.validPassword(password)) {
console.log("password not valid");
return done(null, false);
}
return done(null, user);
});
}));
Run Code Online (Sandbox Code Playgroud)
我正在改变每个函数中的mongoose模型,因为我一次处理多个集合,我想完全控制正在发生的事情. …
我正在 InstallShield MSI 项目上使用 InstallShield 2016,并尝试创建一个带有更新可执行文件的次要补丁包。一切正常,但注册表值在更新后更改为默认值。
我已经考虑过更改 REINSTALLMODE 字符串,但对于将来利用注册表项系统来说,它可能限制太多。我还了解到使用 AppSearch 和 RegLocator 表将值读取到 msi 属性中。我不明白如何使用这些表,所以这是一个我不太明白的解决方案。
我缺少什么?
谢谢。
我想实例化一个包并将函数传递给它重载运算符,以便创建一个通用二进制搜索树.这是规格.
bstgen.ads(片段)
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Unchecked_Deallocation;
GENERIC
type Akey is private;
type TreeRecord is private;
with function "<"(K: in Akey; R: in TreeRecord) return Boolean;
with function ">"(K: in Akey; R: in TreeRecord) return Boolean;
with function "="(K: in Akey; R: in TreeRecord) return Boolean;
PACKAGE BSTGen IS
TYPE St10 IS NEW String(1..10);
TYPE TreePt IS PRIVATE;
PACKAGE EnumIO IS NEW Ada.Text_IO.Enumeration_IO(Akey); USE EnumIO;
Run Code Online (Sandbox Code Playgroud)
driver.adb(片段)
with Ada.Text_IO; use Ada.Text_IO;
WITH BSTGen;
PROCEDURE Driver IS
IP: Integer := 1; …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种从特定查询中获取M文档的方法,从第N个文档开始,而不是在exec()回调中呈现整个集合,然后从那里拼接一个数组.我很清楚.limit(x)从0到x 的哪个工作正常而花哨,但据我所知,我无法选择查询开始限制文档数量的位置,例如limit(10)从5开始.
我试过这样的事情:
Model.find().sort({creationDate: -1}).where("_id").splice([5,10]).exec(function(err, data) {
if(err) res.send(502, "ERROR IN DB DATABASE");
res.send(data);
});
Run Code Online (Sandbox Code Playgroud)
但结果数据包括整个集合.关于如何实现这一点的任何想法?