Vietnam

    Nodejs.vn

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Groups
    • Search

    [Mongoose] Query document follow sub document condition

    Hỏi Đáp
    0
    2
    414
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tranducninhnd94 last edited by tranducninhnd94

      Hi, Các bạn cho mình hỏi mình thiết kế database như trong hình
      0_1513735043490_mgs.PNG

      Làm thế nào để mình có thể query Post document theo điều kiện fullname trong User document (kiểu như trong mysql là dùng câu lệnh join ý)
      Ai biết chỉ mình vơi .
      Thank you so much !

      1 Reply Last reply Reply Quote 0
      • Bờm
        Bờm last edited by

        Bạn dùng Post.aggregate $lookup field user để lấy thông tin user, xong match thêm điều kiện với fullname nữa là ra. Search aggregate và lookup của mongodb là có ví dụ cụ thể

        1 Reply Last reply Reply Quote 0
        • First post
          Last post