Meteor + Mongodb full text search - mongodb

I would like to implement full text search on a mongodb (version 3.0.1) collection through an index. I create the index through the _ensureINdex method during startup on the server side, and then I manually verify its existence (it exists). Then I built out a trivial function housed in Meteor.methods that takes some data (namely, a string) and implements a search on the indexed collection.
mySearchFunction: function(data) {
var res = MyCollection.find({$text: {$search: data } });
console.log(res);
return res;
}
However, the log spits out this rather verbose error.
I20150322-11:57:49.976(-4)? _oplogHandle: null,
I20150322-11:57:49.976(-4)? db:
I20150322-11:57:49.976(-4)? { domain: null,
I20150322-11:57:49.976(-4)? _events: {},
I20150322-11:57:49.976(-4)? _maxListeners: 10,
I20150322-11:57:49.976(-4)? databaseName: 'meteor',
I20150322-11:57:49.976(-4)? serverConfig: [Object],
I20150322-11:57:49.976(-4)? options: [Object],
I20150322-11:57:49.976(-4)? _applicationClosed: false,
I20150322-11:57:49.976(-4)? slaveOk: false,
I20150322-11:57:49.976(-4)? bufferMaxEntries: -1,
I20150322-11:57:49.976(-4)? native_parser: false,
I20150322-11:57:49.976(-4)? bsonLib: [Object],
I20150322-11:57:49.976(-4)? bson: [Object],
I20150322-11:57:49.976(-4)? bson_deserializer: [Object],
I20150322-11:57:49.976(-4)? bson_serializer: [Object],
I20150322-11:57:49.976(-4)? _state: 'connected',
I20150322-11:57:49.977(-4)? pkFactory: [Object],
I20150322-11:57:49.977(-4)? forceServerObjectId: false,
I20150322-11:57:49.977(-4)? safe: false,
I20150322-11:57:49.977(-4)? notReplied: {},
I20150322-11:57:49.977(-4)? isInitializing: true,
I20150322-11:57:49.977(-4)? openCalled: true,
I20150322-11:57:49.977(-4)? commands: [],
I20150322-11:57:49.977(-4)? logger: [Object],
I20150322-11:57:49.977(-4)? tag: 1427039797274,
I20150322-11:57:49.977(-4)? eventHandlers: [Object],
I20150322-11:57:49.977(-4)? serializeFunctions: false,
I20150322-11:57:49.977(-4)? raw: false,
I20150322-11:57:49.977(-4)? recordQueryStats: false,
I20150322-11:57:49.977(-4)? retryMiliSeconds: 1000,
I20150322-11:57:49.977(-4)? numberOfRetries: 60,
I20150322-11:57:49.977(-4)? readPreference: [Object] },
I20150322-11:57:49.977(-4)? _primary: null },
I20150322-11:57:49.977(-4)? _cursorDescription:
I20150322-11:57:49.978(-4)? { collectionName: 'myCollection',
I20150322-11:57:49.978(-4)? selector: { '$text': [Object] },
I20150322-11:57:49.978(-4)? options: { transform: null } },
I20150322-11:57:49.978(-4)? _synchronousCursor: null }
I20150322-11:57:49.981(-4)? Internal exception while processing message { msg: 'method',
I20150322-11:57:49.981(-4)? method: 'myIndexMethod',
I20150322-11:57:49.982(-4)? params: [ 'someString' ],
I20150322-11:57:49.982(-4)? id: '10' } Maximum call stack size exceeded undefined

Related

Why is mongoDB aggregation $count method gives an object of AggregationCursor as result using node.js and promise?

I am trying to get count of an array in a document by using Mongodb aggregation $count operator.
I am using node.js and promise for this. Here is my code:
getDaysPresent:(id)=>{
return new Promise(async(resolve,reject)=>{
let days=await db.get().collection(collection.'student_collection').aggregate([
{
$match:{_id:ObjectId(id)}
},{
$unwind:"$attendance"
},{
$count:"attendance"
}
])
resolve(days)
})
}
When I try this Mongo Db code in Robo3T it gives the key and value object properly. But when code
executed the console of days gives a AggregationCursor objects with the below details:
AggregationCursor {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
readable: true,
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
operation: AggregateOperation {
options: { readPreference: [ReadPreference] },
ns: MongoDBNamespace { db: 'classroom', collection: '$cmd' },
readPreference: ReadPreference {
mode: 'primary',
tags: undefined,
hedge: undefined
},
readConcern: undefined,
writeConcern: undefined,
explain: false,
fullResponse: true,
target: 'student',
pipeline: [ [Object], [Object], [Object] ],
hasWriteStage: false,
cursorState: {
cursorId: null,
cmd: {},
documents: [],
cursorIndex: 0,
dead: false,
killed: false,
init: false,
notified: false,
limit: 0,
skip: 0,
batchSize: 1000,
currentLimit: 0,
transforms: undefined,
raw: undefined,
reconnect: true
}
},
pool: null,
server: null,
disconnectHandler: undefined,
bson: undefined,
ns: 'classroom.$cmd',
namespace: MongoDBNamespace { db: 'classroom', collection: '$cmd' },
cmd: {},
options: {
readPreference: ReadPreference {
mode: 'primary',
tags: undefined,
hedge: undefined
}
},
topology: Server {
_events: [Object: null prototype] {
commandStarted: [Function],
commandSucceeded: [Function],
commandFailed: [Function],
serverOpening: [Function],
serverClosed: [Function],
serverDescriptionChanged: [Function],
serverHeartbeatStarted: [Function],
serverHeartbeatSucceeded: [Function],
serverHeartbeatFailed: [Function],
topologyOpening: [Function],
topologyClosed: [Function],
topologyDescriptionChanged: [Function],
joined: [Function],
left: [Function],
ping: [Function],
ha: [Function],
connectionPoolCreated: [Function],
connectionPoolClosed: [Function],
connectionCreated: [Function],
connectionReady: [Function],
connectionClosed: [Function],
connectionCheckOutStarted: [Function],
connectionCheckOutFailed: [Function],
connectionCheckedOut: [Function],
connectionCheckedIn: [Function],
connectionPoolCleared: [Function],
authenticated: [Function],
error: [Array],
timeout: [Array],
close: [Array],
parseError: [Array],
open: [Array],
fullsetup: [Array],
all: [Array],
reconnect: [Array]
},
_eventsCount: 35,
_maxListeners: Infinity,
s: {
coreTopology: [Server],
sCapabilities: [ServerCapabilities],
clonedOptions: [Object],
reconnect: true,
emitError: true,
poolSize: 5,
storeOptions: [Object],
store: [Store],
host: 'localhost',
port: 27017,
options: [Object],
sessionPool: [ServerSessionPool],
sessions: Set {},
promiseLibrary: [Function: Promise]
},
[Symbol(kCapture)]: false
},
cursorState: {
cursorId: null,
cmd: {},
documents: [],
cursorIndex: 0,
dead: false,
killed: false,
init: false,
notified: false,
limit: 0,
skip: 0,
batchSize: 1000,
currentLimit: 0,
transforms: undefined,
raw: undefined,
reconnect: true
},
logger: Logger { className: 'Cursor' },
s: {
numberOfRetries: 5,
tailableRetryInterval: 500,
currentNumberOfRetries: 5,
state: 0,
promiseLibrary: [Function: Promise],
explicitlyIgnoreSession: false
},
[Symbol(kCapture)]: false
}
My sample document as follow:
{
"_id" : ObjectId("5fd6fa3b4150e552f0b75935"),
"Name" : "Bobby",
"Gender" : "Male",
"RollNo" : "1",
"attendance" : [
"2/1/2021",
"3/1/2021",
"4/1/2021"
]
}
IF you guys know about this please let me know. And by the by this is my first question in stackoverflow so please give me suggestions to improve this question. Thank you
You could use $size operator to compute the length of an array field in the document. Please modify to suit the programming language and driver.
db.user.aggregate([
{
$project: {
length: {
$size: "$attendance"
}
}
}
])
https://mongoplayground.net/p/UbQh1feZaF0
I got the $count properly, when I add toArray() to the end of aggregation method. The count object will be in an array.
getPresentDays:(id)=>{
return new Promise(async(resolve,reject)=>{
var days=await db.get().collection(collection.STUDENT_COLLECTION).aggregate([
{
$match:{_id:ObjectId(id)}
},{
$unwind:"$attendance"
},{
$count:"attendance"
}
]).toArray()
resolve(days[0].attendance)
})
}

Do I need to connect to Mongo over and over again?

I am making a discord bot. When I was using java, I saved the data to mongo by creating different databases for each server my bot is in but on javascript I can only use one database.
And the only database it lets me connect/see is test database, other than that it shows everything as undefined.
And Mongo js docs tell me to connect to database over and over again but when using java I just connected on bot launch and was able to use it whenever I want. I tried all the examples I could find on stackoverflow but none of them helped me at all.
app.js :
require("./handler/mongo")();
client.on("ready", () => {
console.log(global.mongoclient.db("574612262275252231").collection("settings").find({}));
}
mongo.js:
const mongo = require('mongodb').MongoClient;
module.exports = function(){
mongo.connect(uri, (err, client) => {
if(err) throw err;
global.mongoclient = client;
console.log("a");
});
}
console output:
a
Cursor {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
readable: true,
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
operation: FindOperation {
options: {
skip: 0,
limit: 0,
raw: undefined,
hint: null,
timeout: undefined,
slaveOk: true,
readPreference: [ReadPreference],
db: [Db],
promiseLibrary: [Function: Promise]
},
ns: MongoDBNamespace {
db: '574612262275252231',
collection: 'settings'
},
cmd: {
find: '574612262275252231.settings',
limit: 0,
skip: 0,
query: {},
raw: undefined,
hint: null,
timeout: undefined,
slaveOk: true,
readPreference: [ReadPreference]
},
readPreference: ReadPreference { mode: 'primary', tags: undefined },
cursorState: {
cursorId: null,
cmd: [Object],
documents: [],
cursorIndex: 0,
dead: false,
killed: false,
init: false,
notified: false,
limit: 0,
skip: 0,
batchSize: 1000,
currentLimit: 0,
transforms: undefined,
raw: undefined
}
},
pool: null,
server: null,
disconnectHandler: undefined,
bson: undefined,
ns: '574612262275252231.settings',
namespace: MongoDBNamespace { db: '574612262275252231', collection: 'settings' },
cmd: {
find: '574612262275252231.settings',
limit: 0,
skip: 0,
query: {},
raw: undefined,
hint: null,
timeout: undefined,
slaveOk: true,
readPreference: ReadPreference { mode: 'primary', tags: undefined }
},
options: {
skip: 0,
limit: 0,
raw: undefined,
hint: null,
timeout: undefined,
slaveOk: true,
readPreference: ReadPreference { mode: 'primary', tags: undefined },
db: Db {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
s: [Object],
serverConfig: [Getter],
bufferMaxEntries: [Getter],
databaseName: [Getter],
[Symbol(kCapture)]: false
},
promiseLibrary: [Function: Promise]
},
topology: ReplSet {
_events: [Object: null prototype] {
authenticated: [Function (anonymous)],
error: [Array],
timeout: [Array],
close: [Array],
parseError: [Array],
reconnect: [Array],
commandStarted: [Function (anonymous)],
commandSucceeded: [Function (anonymous)],
commandFailed: [Function (anonymous)],
serverOpening: [Function (anonymous)],
serverClosed: [Function (anonymous)],
serverDescriptionChanged: [Function (anonymous)],
serverHeartbeatStarted: [Function (anonymous)],
serverHeartbeatSucceeded: [Function (anonymous)],
serverHeartbeatFailed: [Function (anonymous)],
topologyOpening: [Function (anonymous)],
topologyClosed: [Function (anonymous)],
topologyDescriptionChanged: [Function (anonymous)],
joined: [Function (anonymous)],
left: [Function (anonymous)],
ping: [Function (anonymous)],
ha: [Function (anonymous)],
connectionPoolCreated: [Function (anonymous)],
connectionPoolClosed: [Function (anonymous)],
connectionCreated: [Function (anonymous)],
connectionReady: [Function (anonymous)],
connectionClosed: [Function (anonymous)],
connectionCheckOutStarted: [Function (anonymous)],
connectionCheckOutFailed: [Function (anonymous)],
connectionCheckedOut: [Function (anonymous)],
connectionCheckedIn: [Function (anonymous)],
connectionPoolCleared: [Function (anonymous)],
open: [Function],
fullsetup: [Function],
all: [Function]
},
_eventsCount: 35,
_maxListeners: Infinity,
s: {
coreTopology: [ReplSet],
sCapabilities: [ServerCapabilities],
tag: undefined,
storeOptions: [Object],
clonedOptions: [Object],
store: [Store],
options: [Object],
sessionPool: [ServerSessionPool],
sessions: Set(0) {},
promiseLibrary: [Function: Promise]
},
[Symbol(kCapture)]: false
},
cursorState: {
cursorId: null,
cmd: {
find: '574612262275252231.settings',
limit: 0,
skip: 0,
query: {},
raw: undefined,
hint: null,
timeout: undefined,
slaveOk: true,
readPreference: [ReadPreference]
},
documents: [],
cursorIndex: 0,
dead: false,
killed: false,
init: false,
notified: false,
limit: 0,
skip: 0,
batchSize: 1000,
currentLimit: 0,
transforms: undefined,
raw: undefined
},
logger: Logger { className: 'Cursor' },
s: {
numberOfRetries: 5,
tailableRetryInterval: 500,
currentNumberOfRetries: 5,
state: 0,
promiseLibrary: [Function: Promise],
explicitlyIgnoreSession: false
},
[Symbol(kCapture)]: false
}
And Mongo js docs tell me to connect to database over and over again
Those are simply examples. You can have a global client if you like (which would make sense for real applications).

MongoDB Not Finding Data : returns undefined

I have a datamodel named 'account' that stores a 'user'
var mongoose=require("mongoose");
mongoose.connect("mongodb://localhost/dataseed");
var db=mongoose.connection;
var accountSchema=mongoose.Schema({
user:{
type:mongoose.Schema.Types.ObjectId,
ref:"user"
},
accountholder:{
type:String
},
cvv:{
type:String
},
expiryyear:{
type:String
},
expirymonth:{
type:String
},
accountnumber:{
type:Number
},
currentamount:{
type:Number
},
transferedamount:{
type:Number
},
withdrawnamount:{
type:Number
}
});
var account = module.exports = mongoose.model('account', accountSchema);
When I'm trying to found an account using the account.find() function. However it returns undefined when I try to access account.accountnumber
I'm querying my model as follows:
data.findById({"_id":req.params.id},function(err,data){
console.log("DATA.USER --------------------------------------------------");
console.log(data.user);
if(err)console.log(err);
else{
acessToken.create({user:req.user,data:req.params.id,token:token},function(err,acess){
if(err)console.log(err);
else{
console.log("ACCESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSss");
console.log(acess.user);
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
}
else
{
console.log("------------------------------------------------------------------------------------TYPE OF USER ID: " + typeof(req.user._id));
account.find({"user":req.user},function(err,d){
if(err)console.log(err)
var amount=d.currentamount-data.price;
var transferedamount=d.transferedamount+data.price;
console.log("Amount: "+amount); // NaN
account.findByIdAndUpdate({user:req.user},{currentamount:amount,transferedamount:transferedamount},function(err,update){
if(err)console.log(err);
console.log('Email sent: ' + info.response);
//getUsername of seller
// console.log(data.user)
user.findById({"_id":data.user},function(err,seller){
if(err){
console.log(err);
}else{
var buyer = req.user.username;
var seller = seller.username;
var priceOfData = data.price;
//ccNumber undefined
var ccnumber = d.accountnumber;
console.log("Buyer Name " +buyer);
console.log("Seller Name " +seller);
console.log("Price " +priceOfData);
console.log("Purchased on Credit Card Number " +ccnumber);
res.render('buyer/sold.ejs');
}
});
});
});
}
});
}
});
}
});
Models "data" and "acessToken" are used for finding a product and generating an access token of the purchased product.
This is the output im getting on my console.
5ca9ae4c044bab18588edf5b
ACCESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSss
5cd4cc83c3c65514c61ae4f3
------------------------------------------------------------------------------------TYPE OF USER ID: object
Amount: NaN
{ CastError: Cast to ObjectId failed for value "{ user: 5cd4cc83c3c65514c61ae4f3 }" at path "_id" for model "account"
at MongooseError.CastError (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/error/cast.js:29:11)
at ObjectId.cast (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/schema/objectid.js:232:11)
at ObjectId.SchemaType.applySetters (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/schematype.js:845:12)
at ObjectId.SchemaType._castForQuery (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/schematype.js:1248:15)
at ObjectId.SchemaType.castForQuery (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/schematype.js:1238:15)
at ObjectId.SchemaType.castForQueryWrapper (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/schematype.js:1217:15)
at cast (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/cast.js:252:34)
at Query.cast (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/query.js:4334:12)
at castQuery (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/query.js:4186:18)
at Query._findAndModify (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/query.js:3203:23)
at Query.<anonymous> (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/query.js:2830:8)
at Query._wrappedThunk [as _findOneAndUpdate] (/home/ubuntu/workspace/DataSeed/node_modules/mongoose/lib/helpers/query/wrapThunk.js:16:8)
at process.nextTick (/home/ubuntu/workspace/DataSeed/node_modules/kareem/index.js:369:33)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
message: 'Cast to ObjectId failed for value "{ user: 5cd4cc83c3c65514c61ae4f3 }" at path "_id" for model "account"',
name: 'CastError',
stringValue: '"{ user: 5cd4cc83c3c65514c61ae4f3 }"',
kind: 'ObjectId',
value: { user: 5cd4cc83c3c65514c61ae4f3 },
path: '_id',
reason: undefined,
model:
{ [Function: model]
hooks: Kareem { _pres: [Object], _posts: [Object] },
base:
Mongoose {
connections: [Object],
models: [Object],
modelSchemas: [Object],
options: [Object],
_pluralize: [Function: pluralize],
Schema: [Object],
model: [Function],
plugins: [Object] },
modelName: 'account',
model: [Function: model],
db:
NativeConnection {
base: [Object],
collections: [Object],
models: [Object],
config: [Object],
replica: false,
options: null,
otherDbs: [],
relatedDbs: {},
states: [Object],
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
'$internalEmitter': [Object],
_listening: false,
_events: [Object],
_eventsCount: 1,
_connectionOptions: [Object],
name: 'dataseed',
host: 'localhost',
port: 27017,
user: undefined,
pass: undefined,
client: [Object],
'$initialConnection': [Object],
db: [Object] },
discriminators: undefined,
events:
EventEmitter {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined },
'$appliedMethods': true,
'$appliedHooks': true,
_middleware: Kareem { _pres: [Object], _posts: [Object] },
schema:
Schema {
obj: [Object],
paths: [Object],
aliases: {},
subpaths: {},
virtuals: [Object],
singleNestedPaths: {},
nested: {},
inherits: {},
callQueue: [],
_indexes: [],
methods: {},
methodOptions: {},
statics: {},
tree: [Object],
query: {},
childSchemas: [],
plugins: [Object],
'$id': 7,
s: [Object],
_userProvidedOptions: {},
options: [Object],
'$globalPluginsApplied': true,
_requiredpaths: [] },
collection:
NativeCollection {
collection: [Object],
opts: [Object],
name: 'accounts',
collectionName: 'accounts',
conn: [Object],
queue: [],
buffer: false,
emitter: [Object] },
Query: { [Function] base: [Object] },
'$__insertMany': [Function],
'$init': Promise { [Object] },
'$caught': true } }
Email sent: 250 2.0.0 OK 1557500841 d4sm5108746wrv.42 - gsmtp
Buyer Name murtaza1
Seller Name test1
Price 100
Purchased on Credit Card Number undefined
The problem with your code is that when you query your database you also need to call the populate method exposed by MongoDB and in particular Mongoose which I'm assuming you're using to query the DB. More info on Mongoose docs.
Why this happens? Well, since you're declaring using as a reference to your account Schema when Mongoose query the DB it only returns, without the populate method, the ID of the document referenced by that particular account Schema. Hope this helps you, cheers, sigfried

how can I get other db instance in nodejs 3.0 mongo-client?

I used mongo-nodejs 2.2 and upgraded to 3.0. After upgrading, I found that the method db() in Db class doesn't exist anymore (http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html). This method is very useful to switch to different database instance. I wonder how I can switch to different database with the latest version.
Okay so it is gone, and it's documented as gone and the real message is you should be using Mongoclient.prototype.db instead:
From the 3.0 Changes:
We removed the following API methods.
Db.prototype.authenticate
Db.prototype.logout
Db.prototype.open
Db.prototype.db
...
We've added the following API methods.
MongoClient.prototype.logout
MongoClient.prototype.isConnected
MongoClient.prototype.db
The basic lesson here was wherever you were using Db directly, you should be using the MongoClient instance instead. This is obtained from the very first connection:
const { MongoClient } = require('mongodb');
(async function() {
try {
const conn = await MongoClient.connect('mongodb://localhost');
let test = conn.db('test');
let admin = test.admin();
console.log(admin);
let another = conn.db('another');
console.log(another);
} catch(e) {
console.error(e);
} finally {
process.exit();
}
})()
Returns output like:
Admin {
s:
{ db:
Db {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
s: [Object],
serverConfig: [Getter],
bufferMaxEntries: [Getter],
databaseName: [Getter] },
topology:
Server {
domain: null,
_events: [Object],
_eventsCount: 25,
_maxListeners: Infinity,
clientInfo: [Object],
s: [Object] },
promiseLibrary: [Function: Promise] } }
Db {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
s:
{ databaseName: 'another',
dbCache: {},
children: [],
topology:
Server {
domain: null,
_events: [Object],
_eventsCount: 25,
_maxListeners: Infinity,
clientInfo: [Object],
s: [Object] },
options:
{ readPreference: [Object],
promiseLibrary: [Function: Promise] },
logger: Logger { className: 'Db' },
bson: BSON {},
readPreference: ReadPreference { mode: 'primary', tags: undefined, options: undefined },
bufferMaxEntries: -1,
parentDb: null,
pkFactory: undefined,
nativeParser: undefined,
promiseLibrary: [Function: Promise],
noListener: false,
readConcern: undefined },
serverConfig: [Getter],
bufferMaxEntries: [Getter],
databaseName: [Getter] }
Interestingly the admin() helper still exists on Db instances, which of course is really just a "pre filled" selection to the old db() anyway.
Bottom line, use the MongoClient instance from the connection instead for all future code.

Suddenly seeing lots of Mongo output in server console (Mongo Oplog?)

I absolutely can't think what to Google for this one. It happens when I start meteor up from the command line.
I get a load of output that I don't recognise, and it's a bit annoying because it obscures the output that I want to see. I can't pinpoint the change that made this happen.
I thought I'd observed it happening after DB queries were made too, however I can't see that this morning.
I20150707-10:26:06.097(1)? ----------------------------
I20150707-10:26:06.101(1)? { _mongo:
I20150707-10:26:06.101(1)? { _observeMultiplexers:
I20150707-10:26:06.101(1)? { '{"ordered":false,"collectionName":"users","selector":{"_id":"bhJwk7Lc4mPDzAYno"},"options":{"transform":null,"fields":{"profile":1,"username":1,"emails":1}}}': [Object],
I20150707-10:26:06.102(1)? '{"ordered":false,"collectionName":"users","selector":{"_id":"bhJwk7Lc4mPDzAYno","services.resume.loginTokens.hashedToken":"+uhnI7co8s08w/9A53RTBO+qH/jJvKnHJCIYwRIKZ64="},"options":{"transform":null,"fields":{"_id":1}}}': [Object],
I20150707-10:26:06.102(1)? '{"ordered":false,"collectionName":"users","selector":{"_id":"bhJwk7Lc4mPDzAYno"},"options":{"transform":null,"fields":{"roles":1}}}': [Object],
I20150707-10:26:06.102(1)? '{"ordered":false,"collectionName":"meteor_accounts_loginServiceConfiguration","selector":{},"options":{"transform":null,"fields":{"secret":0}}}': [Object],
I20150707-10:26:06.102(1)? '{"ordered":false,"collectionName":"projects","selector":{"user_ids":"bhJwk7Lc4mPDzAYno"},"options":{"transform":null}}': [Object],
I20150707-10:26:06.102(1)? '{"ordered":false,"collectionName":"sourceTypes","selector":{},"options":{"transform":null}}': [Object] },
I20150707-10:26:06.102(1)? _onFailoverHook: { nextCallbackId: 7, callbacks: [Object] },
I20150707-10:26:06.103(1)? db:
I20150707-10:26:06.103(1)? { domain: null,
I20150707-10:26:06.103(1)? _events: {},
I20150707-10:26:06.103(1)? _maxListeners: 10,
I20150707-10:26:06.103(1)? databaseName: 'meteor',
I20150707-10:26:06.104(1)? serverConfig: [Object],
I20150707-10:26:06.104(1)? options: [Object],
I20150707-10:26:06.104(1)? _applicationClosed: false,
I20150707-10:26:06.104(1)? slaveOk: false,
I20150707-10:26:06.104(1)? bufferMaxEntries: -1,
I20150707-10:26:06.104(1)? native_parser: false,
I20150707-10:26:06.104(1)? bsonLib: [Object],
I20150707-10:26:06.105(1)? bson: [Object],
I20150707-10:26:06.105(1)? bson_deserializer: [Object],
I20150707-10:26:06.105(1)? bson_serializer: [Object],
I20150707-10:26:06.105(1)? _state: 'connected',
I20150707-10:26:06.106(1)? pkFactory: [Object],
I20150707-10:26:06.106(1)? forceServerObjectId: false,
I20150707-10:26:06.107(1)? safe: false,
I20150707-10:26:06.107(1)? notReplied: {},
I20150707-10:26:06.107(1)? isInitializing: true,
I20150707-10:26:06.107(1)? openCalled: true,
I20150707-10:26:06.107(1)? commands: [],
I20150707-10:26:06.107(1)? logger: [Object],
I20150707-10:26:06.108(1)? tag: 1436261154640,
I20150707-10:26:06.108(1)? eventHandlers: [Object],
I20150707-10:26:06.108(1)? serializeFunctions: false,
I20150707-10:26:06.108(1)? raw: false,
I20150707-10:26:06.109(1)? recordQueryStats: false,
I20150707-10:26:06.109(1)? retryMiliSeconds: 1000,
I20150707-10:26:06.109(1)? numberOfRetries: 60,
I20150707-10:26:06.109(1)? readPreference: [Object] },
I20150707-10:26:06.110(1)? _primary: '127.0.0.1:3001',
I20150707-10:26:06.110(1)? _oplogHandle:
I20150707-10:26:06.110(1)? { _oplogUrl: 'mongodb://127.0.0.1:3001/local',
I20150707-10:26:06.110(1)? _dbName: 'meteor',
I20150707-10:26:06.111(1)? _oplogLastEntryConnection: [Object],
I20150707-10:26:06.111(1)? _oplogTailConnection: [Object],
I20150707-10:26:06.111(1)? _stopped: false,
I20150707-10:26:06.111(1)? _tailHandle: [Object],
I20150707-10:26:06.112(1)? _readyFuture: [Object],
I20150707-10:26:06.112(1)? _crossbar: [Object],
I20150707-10:26:06.112(1)? _baseOplogSelector: [Object],
I20150707-10:26:06.113(1)? _catchingUpFutures: [],
I20150707-10:26:06.113(1)? _lastProcessedTS: [Object],
I20150707-10:26:06.114(1)? _onSkippedEntriesHook: [Object],
I20150707-10:26:06.114(1)? _entryQueue: [Object],
I20150707-10:26:06.115(1)? _workerActive: false },
I20150707-10:26:06.115(1)? _docFetcher: { _mongoConnection: [Circular], _callbacksForCacheKey: {} } },
I20150707-10:26:06.116(1)? _cursorDescription:
I20150707-10:26:06.116(1)? { collectionName: 'scrapeLog',
I20150707-10:26:06.116(1)? selector: {},
I20150707-10:26:06.116(1)? options: { transform: null, sort: [Object], limit: 10 } },
I20150707-10:26:06.116(1)? _synchronousCursor: null }