Update mongodb
This commit is contained in:
parent
d32b2a8ce5
commit
9427a756c9
31 changed files with 83 additions and 52 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as mongo from 'mongodb';
|
||||
import isObjectId from '../../misc/is-objectid';
|
||||
import { publishMainStream } from '../../stream';
|
||||
import User from '../../models/user';
|
||||
import NoteUnread from '../../models/note-unread';
|
||||
|
@ -11,11 +12,11 @@ export default (
|
|||
note: string | mongo.ObjectID
|
||||
) => new Promise<any>(async (resolve, reject) => {
|
||||
|
||||
const userId: mongo.ObjectID = mongo.ObjectID.prototype.isPrototypeOf(user)
|
||||
const userId: mongo.ObjectID = isObjectId(user)
|
||||
? user as mongo.ObjectID
|
||||
: new mongo.ObjectID(user);
|
||||
|
||||
const noteId: mongo.ObjectID = mongo.ObjectID.prototype.isPrototypeOf(note)
|
||||
const noteId: mongo.ObjectID = isObjectId(note)
|
||||
? note as mongo.ObjectID
|
||||
: new mongo.ObjectID(note);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue