I have a problem inserting this document in Atlas:
{
"provider_id": {
"$binary": {
"base64":"EEcD/D8V5nFBWgMzZXhlsA==",
"subType":"04"
}
}
It save to the database with subtype “03”!!!
steevej
(Steeve Juneau)
February 26, 2020, 8:43pm
2
It must be a typo when you inserted it as I was able to it.
MongoDB Enterprise Sandbox-shard-0:PRIMARY> d
{
"provider_id" : {
"$binary" : {
"base64" : "EEcD/D8V5nFBWgMzZXhlsA==",
"subType" : "04"
}
}
}
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.test.insertOne( d )
{
"acknowledged" : true,
"insertedId" : ObjectId("5e56d55d8ed2e69dc94143e5")
}
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.test.find( { "_id" : ObjectId("5e56d55d8ed2e69dc94143e5") } ).pretty()
{
"_id" : ObjectId("5e56d55d8ed2e69dc94143e5"),
"provider_id" : {
"$binary" : {
"base64" : "EEcD/D8V5nFBWgMzZXhlsA==",
"subType" : "04"
}
}
}
Hy steevej,
sorry, I don’t explain well.
I can’t do it from the portal (INSERT DOCUMENT, button in the image):
from my app and shell, I can.
steevej
(Steeve Juneau)
February 26, 2020, 11:05pm
4
I understand better. And I could reproduce. Same insert(with extra comment) in Atlas (https://cloud.mongodb.com ) gives
{
"_id" : ObjectId("5e56f71e0cf72ad66d312c76"),
"comment" : "insert in atlas portal",
"provider_id" : BinData(3,"ceYVP/wDRxCwZXhlMwNaQQ==")
}
In addition, inserting in Compass gives:
{
"_id" : ObjectId("5e56f5bc1e8b1832c4edb65f"),
"comment" : "inserted with Compass",
"provider_id" : UUID("104703fc-3f15-e671-415a-0333657865b0")
}
I don’t know what to say. Awaiting an answer with you.
coderkid
(Kay Anar)
February 26, 2020, 11:27pm
5
@Rainer_Leon This must be Atlas bug, I can reproduce the problem, when I insert from Atlas Web UI, it inserts it as
{
"_id" : ObjectId("5e56fc89f1f42d119bca2302"),
"provider_id" : BinData(3, "ceYVP/wDRxCwZXhlMwNaQQ==")
}
When I insert same thing from Studio 3T or Compass I get this
{
"_id" : ObjectId("5e56fe213a3725650e75c144"),
"provider_id" : {
"$binary" : {
"base64" : "EEcD/D8V5nFBWgMzZXhlsA==",
"subType" : "04"
}
}
}
Did you solve this in the end?
I am trying to export documents that contain UUIDs and then import them back. When I export to json, the UUIDs are turned into Binary Type 00 and mess everything up!
I’ve added a post with all the details about this on StackOverflow: link