You can't use javascript, so "new ObjectId(...)" won't work. That would only work in the console, which we don't have access to.
But you can use '$oid' like so:
{ "_id" : { "$oid" : "597f73ae46e0fb0001b865f4" } }
https://docs.mongodb.com/manual/reference/mongodb-extended-json/
Drew Ferraro
hi,
I am trying to insert a document using NoSQL explorer which would contain an ObjectId, but I get the following error:
"Error parsing JSON. Please use valid JSON, including double-quotes on object keys."
hichhichhich
my document looks like this:
[
{
"_id": new ObjectId("597f73ae46e0fb0001b865f3"),
"Name": "Baz",
"Type": "Bing"
}
},
{
"_id":new ObjectId( "597f73ae46e0fb0001b865f4"),
"Name": "Foo",
"Type": "Bar"
}
}
]
I have tried removing the 'new' keyword and a few other things, to no avail.
How can I specify I want an ObjectID as the type so that it doesn't create a string, using the NoSQL explorer?
Thanks for any help!