does mongo return a document or json object code example
Example 1: mongodb check for array not empty query
collection.find({ arrayElementName: { $exists: true, $not: {$size: 0} } })
Example 2: how to return an object in javascript
function func() {
return {
name: "Name",
age: 34
};
}