title: nearest neighbour in dataset Node.js
body: <p>I have a Node.js application that saves data to MongoDB.
  Given one document, I want to find the most similar document in the database.</p>
  
  <p>My idea is to implement some sort of nearest neighbour algorithm that takes all the records as a training sequence and returns the most similar document (including some sort of percentage on how similar these two documents are.)</p>
  
  <p>E.g. having these records in my database...</p>
  
  <pre><code>{ name: "Bill",   age: 10,  pc: "Mac",      ip: "68.23.13.8" }
  { name: "Alice",  age: 22,  pc: "Windows",  ip: "193.186.11.3" }
  { name: "Bob",    age: 12,  pc: "Windows",  ip: "56.89.22.1" }
  </code></pre>
  
  <p>...I want to find the closest document to this one</p>
  
  <pre><code>{ name: "Tom", age: 10, pc: "Mac", ip: "68.23.13.10" }
  // algorithm returns "Bill", .76 
  </code></pre>
  
  <p>Are there any Node modules/implementations that take any kind of objects/parameters and return their nearest neighbour?</p>