Recently, I have encountered an issue with a script that looks like this:
use first_db;
advertisers = db.agencies.find( 'my query which returns things correctly );
close first_db;
use second_db;
db.advertisers.insert(advertisers);
This error message pops up when I try to run it:
Tue Jun 5 14:15:07 TypeError: advertisers.toJSON is not a function (shell):1
Any ideas on how to resolve this? Should I convert the original result to JSON before inserting it? or do I need to utilize a specific function?
Your insights are much appreciated!