title: Vapor 4 fluent. Complex query, filter and create if doesn't exist
body: <p>I'm trying to query a Chat with two users. If it exists I'd like to return it. If not I'd like to create new chat with those two users and return it.</p>
  <p>Comment shows where it fails if chat exists.</p>
  <p>Also would be helpful if you can show how to create new chat with those two users in this scenario.</p>
  <pre class="lang-swift prettyprint-override"><code>func create(req: Request) throws -&gt; EventLoopFuture&lt;Chat&gt; {
    
    let currentUser = try req.auth.require(User.self)
    
    guard
      let userID = req.parameters.get(&quot;userID&quot;),
      let uuid = UUID(userID)
    else { throw Abort(.badRequest) }
    
    return User
      .query(on: req.db)
      .filter(\.$id == uuid)
      .with(\.$chats)
      .first()
      .unwrap(or: Abort(.internalServerError))
      .flatMap({ chatUser -&gt; EventLoopFuture&lt;Chat&gt; in
        
        let chat = chatUser
          .chats
          .filter({
            $0.users.contains(where: { $0.id == currentUser.id }) // FAILS HERE: Fatal error: Siblings relation not eager loaded, use $ prefix to access: Siblings&lt;Chat, User, ChatUser&gt;(from: [chat_id], to: [user_id]): file
          })
          .first
        
        if let chat = chat {
          
          return req
            .eventLoop
            .makeSucceededFuture(chat)
          
        } else {
          
          // create new chat with those two users and return
          
        }
      })
  }
  </code></pre>
  <p>Simplified models:</p>
  <pre class="lang-swift prettyprint-override"><code>final class Chat: Model, Content {
    @ID(key: .id)
    var id: UUID?
    
    @Siblings(through: ChatUser.self, from: \.$chat, to: \.$user)
    var users: [User]
  }
  
  final class User: Model, Content {
    @ID(key: .id)
    var id: UUID?
    
    @Siblings(through: ChatUser.self, from: \.$user, to: \.$chat)
    var chats: [Chat]
  }
  
  final class ChatUser: Model {
    @ID(key: .id)
    var id: UUID?
  
    @Parent(key: Keys.chatId)
    var chat: Chat
  
    @Parent(key: Keys.userId)
    var user: User
  }
  </code></pre>