mongoose#Collection TypeScript Examples

The following examples show how to use mongoose#Collection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From opentelemetry-ext-js with Apache License 2.0 7 votes vote down vote up
function getAttributesFromCollection(collection: Collection): SpanAttributes {
    return {
        [SemanticAttributes.DB_MONGODB_COLLECTION]: collection.name,
        [SemanticAttributes.DB_NAME]: collection.conn.name,
        [SemanticAttributes.DB_USER]: collection.conn.user,
        [SemanticAttributes.NET_PEER_NAME]: collection.conn.host,
        [SemanticAttributes.NET_PEER_PORT]: collection.conn.port,
        [SemanticAttributes.NET_TRANSPORT]: 'IP.TCP', // Always true in mongodb
    };
}