updated indexes

This commit is contained in:
Andris Reinman 2018-08-14 23:03:12 +03:00
parent 945dfc98d8
commit b6698843b1
2 changed files with 7 additions and 22 deletions

View file

@ -134,26 +134,20 @@ indexes:
- collection: authlog
type: users # index applies to users database
index:
name: user_action
name: user_by_ip
key:
user: 1
action: 1
ip: 1 # List events for user by IP
_id: -1
- collection: authlog
type: users # index applies to users database
index:
name: by_session
key:
session: 1
sparse: true
partialFilterExpression:
ip: true
- collection: authlog
type: users # index applies to users database
index:
name: by_ip
key:
ip: 1
ip: 1 # All events from this IP
sparse: true
- collection: authlog

View file

@ -230,10 +230,6 @@ module.exports = (db, server, userHandler) => {
.lowercase()
.empty('')
.max(100),
sess: Joi.string()
.trim()
.empty('')
.max(100),
ip: Joi.string().ip({
version: ['ipv4', 'ipv6'],
cidr: 'forbidden'
@ -273,9 +269,10 @@ module.exports = (db, server, userHandler) => {
let user = new ObjectID(result.value.user);
let limit = result.value.limit;
let action = result.value.action;
let sess = result.value.sess;
let ip = result.value.ip;
let page = result.value.page;
let pageNext = result.value.next;
let pagePrevious = result.value.previous;
@ -309,12 +306,6 @@ module.exports = (db, server, userHandler) => {
}
let filter = { user };
if (action) {
filter.action = action;
}
if (sess) {
filter.sess = sess;
}
if (ip) {
filter.ip = ip;
}