Upon running the command from the console, I receive an ordinal object as follows:
>> db.query.find({"user_id":"111"})
{ "_id" : ObjectId("58bbf5bf17cc9100046bdff"), "query" : "my query", "user_id" : "111", "links" : [ ] }
However, when executing the following code (for the same user_id
), it fails at JSON.stringify(results)
displaying an error of
Converting circular structure to JSON
:
var args = {'user_id': userId};
console.log("database: query.find(%s)", JSON.stringify(args));
db.collection('query').find(args, function(err, results){
if(err) {
console.error(JSON.stringify(err));
}
console.log("results:", JSON.stringify(results));
});
The question remains: Why does this occur?