title: MongoDB - do I need to convert string id's I insert manually as a reference to another document into ObjectId(id)?
body: <p>Im learning mongodb and I have the following question: In one Schema, I have a reference to another model - Im storing id's of books. I have a books model where I have a reference to other books - saving their id's.</p>
  <p>The id's of 'similarBooks' I will insert manually. But id's of the books will be always in the format of</p>
  <pre><code>ObjectId(&quot;1234&quot;). 
  </code></pre>
  <p>If user clicks on the name of book a query will be made - findById. However the id's I manually inserted are just strings, not ObjectId(&quot;id&quot;) so it wouldnt find the book. What is the best way to handle this? Do I then in my query take the id (the one thats just a string) and convert it to ObjectId(&quot;id&quot;) or do I not just insert manually the id as string but already convert to ObjectId. If so how? So far I just been adding data for this type of models in 3t studio.</p>
  <p>Same question is for writing tests. If i have ids stored as strings, do I convert to the ObjectId ?</p>
  <p>Thank you!</p>
  <pre><code>const bookSchema = new mongoose.Schema({
      title: {
          type: String,
          required: true
      },
      similarBooks: {
          name: {
              type: [String] //would be only 2
          },
          id: {
              type: [String]  //would be only 2
          }
      }
      ...
  })
  </code></pre>