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