MongoFs is an application that mounts MongoDB as read-only filesystem. It uses Dokany to handle low level driver stuff.
MongoFs is more of proof-of-concept prototype than something usable.
-
Install Dokany version 1.4.1 or greater.
-
Clone this repository.
-
Issue a command
dotnet build .\MongoFs\MongoFs.csproj -p:Configuration=Release;Platform=x64- Executable will be at
\MongoFs\bin\x64\Release\net5.0\MongoFs.exe
MongoFs 1.0.0
Copyright (C) 2021 MongoFs
--log-file Path to a log file.
--log-console (Default: false) Enable console logging.
--log-level (Default: Information) Log level.
-c, --connection-string Required. Connection string to MongoDb (eg. mongodb://localhost:27017)
-n, --name Required. Name of a MongoDb instance.
-p, --path Required. Mount point (M:\) or mount path (C:\mongodb). Note the ending slash.
-t, --threads (Default: 2) Number of threads to be used internally by Dokan library. More thread will handle more event at the same time.
--help Display this help screen.
--version Display version information.
For example,
mongofs -c mongodb://localhost:27017 -n "My Localhost mongodb" -p M:\This command connects to mongodb instance at localhost:27017 and mounts it at M:\ named My Localhost mongodb
PS. Ending slash at mount point is mandatory.
| Path | Description |
|---|---|
| \ | Lists databases |
| \buildInfo.json | Result of buildInfo command as json |
| \currentOp.json | Result of currentOp command as json |
| \hostInfo.json | Result of hostInfo command as json |
| \listCommands.json | Result of listCommands command as json |
| \serverStatus.json | Result of serverStatus command as json |
| Path | Description |
|---|---|
| \database | List collections in database database |
All paths below are related to collection collection in database database.
| Path | Description |
|---|---|
| \indexes.json | Collection indexes |
| \stats.json | Collection stats |
| \data | All documents of collection |
| \query | Folder for querying documents |
WARNING: Be extra carefull with data\ directory as opening it will cause enumeration of all documents in collection. And if something on your pc decides to index newly mounted drive...oh boy.
To query(filter) documents you have to manually type path in Windows file explorer or whatever file explorer you use.
| Path | Description |
|---|---|
| value | Filters documents where _id equals any of all possible BSON values value is convertible to. |
| field\value | Filters documents where field equals any of all possible BSON value value is convertible to. |
\logs\backend\query\507f191e810c19729de860eais converted to
{$or:[
{"_id":ObjectId("507f191e810c19729de860ea")},
{"_id":"507f191e810c19729de860ea"}
]}and that filter is sent to backend collection in logs database.
\logs\backend\query\Level\Erroris converted to
{$or:[
{"Level":"Error"}
]}\logs\backend\query\IsRequestHalted\trueis converted to
{$or:[
{"IsRequestHalted":true}
]}\logs\backend\query\_id\3456is converted to
{$or:[
{"_id":NumberInt(3456)},
{"_id":NumberLong(3456)},
{"_id":NumberDecimal(3456)},
{"_id":"3456"}
]}