Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-875

DBRef inspect result is not re-evaluatable

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.15.6
    • Affects Version/s: None
    • Component/s: Bson
    • None
    • 2
    • Needed
    • Hide

      I’m not sure if this is documented anywhere, but the second argument to DBRef() constructor is the literal _id that it refers to, which can be any type of document or BSON object. Typically, it will be an ObjectId, i.e.:

       DBRef('db', ObjectId('60e47400d0b09942eb67d890'))
      

      mongosh accepts this as a an input format and also print DBRefs like this.

      Show
      I’m not sure if this is documented anywhere, but the second argument to DBRef() constructor is the literal _id that it refers to, which can be any type of document or BSON object. Typically, it will be an ObjectId, i.e.: DBRef( 'db' , ObjectId( '60e47400d0b09942eb67d890' )) mongosh accepts this as a an input format and also print DBRefs like this.
    • Iteration Firenze

      > DBRef("a", ObjectId("5f16b8bebe434dc98cdfc9cb"), "db")
      DBRef("a", "5f16b8bebe434dc98cdfc9cb", "db"
      

      where the second argument should include ObjectId(), like the original input.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: