mongodb我无法在另一个集合中通过城市ID获取城市信息

时间:2020-06-12 17:40:29

标签: node.js mongodb mongoose

请帮忙。 我有两个收藏夹:

酒店:


    _id: ObjectId("5edabde015563b1ed0058862")
    address: Object
        city: ObjectId("5ee381b36da22c44405003cb")
        street: "Avenue de la Lanterne 50"

城市:


    _id: ObjectId("5ee381b36da22c44405003cb")
    label: Barselona

如何在酒店按ID获取城市标签?

我正在这样做,但不能正常工作

{
    "$lookup": {
        "from": "cities",
        "localField": "address['city']",
        "foreignField": "_id",
        "as": "city"
    }
}

猫鼬计划:

let dismissAction = UNNotificationAction(identifier: "dismiss", title: "Dismiss", options: UNNotificationActionOptions.foreground)

let dismissAction2 = UNTextInputNotificationAction(identifier: "dismiss",
                                                              title: "Dismsiss",
                                                              options:.authenticationRequired, textInputButtonTitle: "Button", textInputPlaceholder: "")

let dismissCategory = UNNotificationCategory(identifier: "dismissCategory",
                                                         actions: [dismissAction],
                                                         intentIdentifiers: [],
                                                         options: [])

UNUserNotificationCenter.current().setNotificationCategories([dismissCategory])
UNUserNotificationCenter.current().delegate = self

let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })

0 个答案:

没有答案