Closed resurtm closed 6 years ago
Thanks @resurtm for the report. I'll try to add this features for the next release, after the final release of MongoDB 3.6.
Meanwhile you can use the option -v, --verbose
to see the raw information about the query, but it prints a lots of information about the query and without parsing special types like ObjectId
.
Can you provide me an example of how to add a registry with an insert
query with a binary field using the mongodb console?
@mrsarm, thanks!
I'm not sure how it can be reproduced using MongoDB shell. However you can try the following PyMongo code:
import pprint
from pymongo import MongoClient
client = MongoClient()
client.test_db.test_collection.insert_one({
'test_field': 'проверка'.encode('utf-8'),
})
for item in client.test_db.test_collection.find():
pprint.pprint(item['test_field'])
pprint.pprint(item['test_field'].decode('utf-8'))
I think it does what you want:
Ok, looks easy to run and test. Thanks for the example!
Thanks @resurtm for your report, I'm adding support for this field type. Here are the different ways to represent binary data: https://docs.mongodb.com/manual/reference/mongodb-extended-json/#binary
Added support to BinData
in upcomming v2.2.0
Released!
Anyway the support to serialize binary data from PyMongo driver + Python 2.x is really bad. So any binary field will displayed as an string in the log output with the no ASCII charactesr scaped, I recommend to install mongotail with Python 3 to get a correct visualization:
First uninstall from Python 2 with:
$ pip uninstall mongotail
Then install with:
$ pip3 install mongotail
@mrsarm Great! Thanks!
Hello @mrsarm!
Looks like mongotail does not support
bytes
(i.e. binary data) coming from MongoDB. Please consider the following details regarding found bug:Mongotail
MongoDB
Data in MongoDB:
Let me know if you need more details or I'm missing something.
Thank you for such a nice project as mongotail! :+1:
Cheers, @resurtm