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. C# MongoDB Question

C# MongoDB Question

Scheduled Pinned Locked Moved Database
questioncsharpdatabasemongodbsql-server
3 Posts 3 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I'm very new with MongoDb, so excuse my ignorance. I know that MongoDb doesn't store data in "tables" like SQL Server, but is there any way to look at the "structure" of a container? Basically I'd like to see the shape of the data. Thanks.

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    K J 2 Replies Last reply
    0
    • K Kevin Marois

      I'm very new with MongoDb, so excuse my ignorance. I know that MongoDb doesn't store data in "tables" like SQL Server, but is there any way to look at the "structure" of a container? Basically I'd like to see the shape of the data. Thanks.

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      K Offline
      K Offline
      k5054
      wrote on last edited by
      #2

      You do have the mongo cli, which allows you to query the data, etc. But there is no "shape" to the data, like there is with SQL Data. Mongodb has "collections" which are roughly equivalent to tables, but unlike SQL tables, they have no structure imposed on them. e.g.

      MongoDB shell version: 3.2.12
      connecting to: test

      db.mycoll.find()
      db.mycoll.insertOne( { x: 1} )
      {
      "acknowledged" : true,
      "insertedId" : ObjectId("5c62fb2a93ce6e6b14a14369")
      }
      db.mycoll.insertOne( { able: 1, baker: "hello world", charlie: {xray: 0, zulu: 6.9} } )
      {
      "acknowledged" : true,
      "insertedId" : ObjectId("5c62fb5293ce6e6b14a1436a")
      }
      db.mycoll.find()
      { "_id" : ObjectId("5c62fb2a93ce6e6b14a14369"), "x" : 1 }
      { "_id" : ObjectId("5c62fb5293ce6e6b14a1436a"), "able" : 1, "baker" : "hello world", "charlie" : { "xray" : 0, "zulu" : 6.9 } }

      1 Reply Last reply
      0
      • K Kevin Marois

        I'm very new with MongoDb, so excuse my ignorance. I know that MongoDb doesn't store data in "tables" like SQL Server, but is there any way to look at the "structure" of a container? Basically I'd like to see the shape of the data. Thanks.

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        That other reply is precise but not very useful. If you have a Mongodb where collections do not have some specific form then you are using it wrong. Besides the CLI I have also used two different UI clients for Mongo and both show the data that are in the collections in a reasonable way. Now if you are starting with a empty collection you won't know what will go in there and with a SQL table you would but that that is somewhat a matter of degree and not usability. In that case you should go look to your design, which you should have regardless, or the code.

        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