Closed Azizalorabi closed 2 years ago
If you need Get-MdbcCollection
to return collections you should either specify the database or use Connect-Mdbc
with a database name specified as the parameter.
I tried (DarknessEye is the name of the DB): Import-Module Mdbc Connect-Mdbc -ConnectionString mongodb://127.0.0.1:27017 Get-MdbcCollection DarknessEye
Result shows : CollectionNamespace : test.DarknessEye Database : MongoDB.Driver.MongoDatabaseImpl DocumentSerializer : MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer Indexes : MongoDB.Driver.MongoCollectionImpl`1+MongoIndexManager[MongoDB.Bson.BsonDocument] Settings : AssignIdOnInsert=True;GuidRepresentation=Standard;ReadConcern={ };ReadEncoding=null;ReadPreference={ Mode : Primary };WriteConcern={ };WriteEncoding=null
Have you taken a look at the help? E.g. help Connect-Mdbc -full
etc.
You should use a command like this, to connect to a database:
Connect-Mdbc -ConnectionString mongodb://127.0.0.1:27017 -DatabaseName DarknessEye
This command is not supposed to show anything. Can you get the complete sequence of commands and expected/actual results for each?
Yes It worked out! Now It makes sense to me. Can you keep the issue open please until I can insert documents? and get back to you if there is any issue :) I will use help New-MdbcData -Full , I promise :)
This works perfectly Thank you!
You are very welcome! I am closing this one. Feel free to open another issue.
Hi nightroman Thank you very much for this useful tool. I don't think this is an issue , maybe I dont know yet hoe to use Mdbc. I am using Mac M1 visual studio > Powershell core. When I try to connect to MongoDB I just use the following: Import-Module Mdbc Connect-Mdbc -ConnectionString mongodb://127.0.0.1:27017 Get-MdbcDatabase
And I can see the databases but if I want to see the collection inside a database I got nothing no error (IP_LOOKUP is the name of the collection): Get-MdbcCollection No result no error
Get-MdbcCollection -Name IP_LOOKUP --- this is the result: CollectionNamespace : test.IP_LOOKUP Database : MongoDB.Driver.MongoDatabaseImpl DocumentSerializer : MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer Indexes : MongoDB.Driver.MongoCollectionImpl`1+MongoIndexManager[MongoDB.Bson.BsonDocument] Settings : AssignIdOnInsert=True;GuidRepresentation=Standard;ReadConcern={ };ReadEncoding=null;ReadPreference={ Mode : Primary };WriteConcern={ };WriteEncoding=null
But makes no sense to me. I will try later to insert data inside the collection but I can't get it yet :)