MongoDB Collection export error Path collision at tokens - mongodb

I am trying to export my collections from Atlas to my Local MongoDB with MongoDB Compass tool. The issue is I can export some collections but my user collection returning error.
Error is: Path collision at tokens.0BUo4-zWowM9ldTIUbs57Q remaining portion 0BUo4-zWowM9ldTIUbs57Q
Any help appreciated, thanks.
MongoDB Compass version is 1.28.1

This error occurs because there are two different types. Probably you have your token set as an object, or as an empty string.
The solution to use Mongo Compass is manually unchecking the "Root level field" that marks as a string. Check the following example:
The error occurs because the field "Fotos_da_Ocorrência" can be an empty string "" or and object {bucketName: "", comment: "", elementId: ""}.
When i uncheck the Root Level Field it exports normally.

By some search, I saw some other people facing similar problem. So it may be caused by some bug on MongoDB Compass version is 1.28.1. Workaround solution was using command line interface like below.
mongodump --uri="<connection-string>" --out /path/to/export

Related

Full-text-search on mongoDB using Compass

I am using MongoDB Compass. I'm creating my queries in Compass query language (programming-language-agnostic, so I can port it over to other languages later via Compasss). My problem? I can't figure out what I'm doing wrong in this query. There are no docs explaining MongoDB Compass syntax for $search.
My indexed text field is called markdown_1, my query is "my" (or whatever the user enters), and the object that is being searched looks like this:
How do I get this query to return anything? As of now, it finds nothing.
Thanks!

How to view entire array in MongoDB shell?

I am doing a Mini project in MongoDB recently. I am trying to find out the distinct values of field using the db.collections.distinct(<field>)command.
The above command retrieves all the distinct values of the given field inside an array. But as I have 12k documents all the values are not getting displayed in my console.
This is the output I get.. how to view the entire result?
I have search the internet and documentation but I was not able to get a proper answer.
The mongosh is a Node.js environment. There are several solutions, e.g. JSON.stringify the array or use util.inspect.
JSON.stringify(db.collections.distinct(<field>))
util.inspect(db.collections.distinct(<field>), { maxArrayLength: null })

Collection name error while importing Json to MongoDB

As I was importing a new json file to my mongodb collection I've accidentally use just one '-' instead of 2. Eg.:
mongoimport --host=127.0.0.1 --db=dataBaseName -collection=people --file=importFile.json
I believe that due to the lack of the second '-', now I'm stuck with the following results when I type show collections:
people
ollection=people
I can't access, drop or interact with the second one. Apart from droping the database and starting over, is there a way around this issue?
You can rename the collection like:
> use YourDatabase
// Might wanna drop people collection first
> db.getCollection("ollection=people").renameCollection("people")
Hope This helps!

Show Mongodb query projection in the Log

(updated)
I want to see the field restriction (projection) used in a query in the log, not just the query itself, so I can see exactly what's being requested. I've set 'vvvv=true' along with 'verbose=true' in the config file, so given a shell query;
db.col.find({},{Name:1}).count()
I can then see this in the log;
command: {"count":"col, query:{_id:23}, fields: {Name: 1.0}}}
However, the following query does NOT.
db.col.find({_id:23},{Name:1})
Nor am I seeing this through the C# driver when I use Fields.Include on the MongoCursor.
What am I missing?
The MongoD server currently does not log the projection. There is a ticket in our JIRA for this: https://jira.mongodb.org/browse/SERVER-3129 — please vote for it if you want to show this is important to you.

MongoDB - mongohub gui - queries by _id objectid type

I am using MongoHub GUI for MongoDB: http://mongohub.todayclose.com/
I would like to be able to query by ObjectId as this is what MongoHub is returing for _id. How to do this, something like {"_id":"4d1b4687a6d5437619000000"} is not working??
cheers,
/Marcin
try following code:
{"_id": ObjectId("4d1b4687a6d5437619000000")}
check this for more details
It looks as if MongoHub is broken in the case of supplying a function in a query (ObjectId, as galimy rightly suggested). If you enter the query as galimy suggested, then copy and paste the full query that MongoHub says it's going to execute (grayed out above the Query text input) into a connected mongo CLI console, it works fine.
I would recommend learning to use the mongo console -- I've found two bugs in 5 minutes of playing with MongoHub, and when you're typing in JSON for your queries anyway the GUI is doing very little for you.
OK, it has been fixed in recent MongoHub release. Cheers
{"_id": { $oid: "4d1b4687a6d5437619000000"}} definitely should work. Java MongoDB driver implicitly creates ObjectId object in the object has '$oid' property.
Also all the same is for date using '$date' property.