Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. storing a byte[] array in MongoDB

storing a byte[] array in MongoDB

Scheduled Pinned Locked Moved Database
mongodbcsharpjavascriptcomdata-structures
4 Posts 2 Posters 0 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jkirkerx
    wrote on last edited by
    #1

    I store a secret as byte[] in MongoDB, and went to decrypt and it failed. so In my .Net class I used byte[]. "Secret" : { "$binary" : "o2lBkODfRqw=", "$type" : "00" }, What would be the correct way? string? to Base64 and back on a side note, I used Bson Date format to store a date, but in TypeScript can't pull the time offset from it. Should I just dump the Bson decorator and just use Date? Or just test and see if it works.

    If it ain't broke don't fix it Discover my world at jkirkerx.com

    J 1 Reply Last reply
    0
    • J jkirkerx

      I store a secret as byte[] in MongoDB, and went to decrypt and it failed. so In my .Net class I used byte[]. "Secret" : { "$binary" : "o2lBkODfRqw=", "$type" : "00" }, What would be the correct way? string? to Base64 and back on a side note, I used Bson Date format to store a date, but in TypeScript can't pull the time offset from it. Should I just dump the Bson decorator and just use Date? Or just test and see if it works.

      If it ain't broke don't fix it Discover my world at jkirkerx.com

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      My Bad, I can store a byte[] in MongoDB. I had changed the secret by mistake on login.

      If it ain't broke don't fix it Discover my world at jkirkerx.com

      N 1 Reply Last reply
      0
      • J jkirkerx

        My Bad, I can store a byte[] in MongoDB. I had changed the secret by mistake on login.

        If it ain't broke don't fix it Discover my world at jkirkerx.com

        N Offline
        N Offline
        Nathan Minier
        wrote on last edited by
        #3

        Glad you got it sorted. How's Mongo been treating you?

        "Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor

        J 1 Reply Last reply
        0
        • N Nathan Minier

          Glad you got it sorted. How's Mongo been treating you?

          "Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor

          J Offline
          J Offline
          jkirkerx
          wrote on last edited by
          #4

          So far so good. I really like it. Finally got use to the ObjectId and my models are matching up in .Net Core and Angular. The Net Core Mongo drivers are pretty cool, but a whole different beast. MongoDB is fine for my portfolio website and a good learning experience. Got praise last night at the Agile meetup for taking the time to learn it. So it be a valuable tool or experience. I’m in Vegas for the weekend, won $50 so far.

          If it ain't broke don't fix it Discover my world at jkirkerx.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups