Find all documents that share the same IP in the array

I have a collection of users, and inside this collection each user have an Array with their IPS.

{
    "_id" : "userID_1",
    "ips" : [ 
        "32.132.322.123", 
        "23.32.222.342"
    ]
}, {
    "_id" : "userID_2",
    "ips" : [ 
        "32.132.322.123", 
        "78.234.52.22"
    ]
}, {
    "_id" : "userID_3",
    "ips" : [ 
        "32.234.212.64", 
        "78.234.52.22"
    ]
},{
    "_id" : "userID_4",
    "ips" : [ 
        "1.233.24.21", 
        "5.44.232.445"
    ]
}

In this case it supose to return userID_1, userID_2 and userID_3 because user1 shares an IP with user2 and user2 with user3.
How can I do that?

26 thoughts on “Find all documents that share the same IP in the array”

  1. 541324 802795Water-resistant our wales in advance of when numerous planking. The particular wales surely are a selection of heavy duty snowboards that this height ones would be exactly the same in principle as a new shell planking having said that with much a lot more height to help you thrust outward inside the evening planking. planking 757080

    Reply
  2. 75860 925830Ive applied the valuable points from this page and I can certainly tell that it gives plenty of assistance with my present jobs. I would be very pleased to maintain obtaining back in this web page. Thank you. 505782

    Reply
  3. 16278 572475This style is steller! You most definitely know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (properly, almostHaHa!) Great job. I actually loved what you had to say, and far more than that, how you presented it. Too cool! 532140

    Reply
  4. 685631 214387Soon after I initially commented I clicked the -Notify me when new feedback are added- checkbox and now each time a remark is added I get four emails with the same comment. Is there any method you will be able to take away me from that service? Thanks! 733084

    Reply
  5. 450614 697483Hey, you used to write excellent, but the last couple of posts have been kinda boringK I miss your super writings. Past few posts are just slightly out of track! come on! 390258

    Reply
  6. 277562 142082Wow! This could be one certain with the most useful blogs Weve ever arrive across on this topic. Basically Outstanding. Im also an expert in this subject therefore I can realize your effort. 315457

    Reply

Leave a Comment