Search This Blog

Monday, June 25, 2018

MongoDB : Collection and statistics Information

------get all the database collection count at once:---------

db.getCollectionNames().map(function(colName){return {"columnName":colName,"count":db.getCollection(colName).count()}});


----The following script prints the statistics for each database:----------


db._adminCommand("listDatabases").databases.forEach(function (d) {
   mdb = db.getSiblingDB(d.name);
   printjson(mdb.stats());
})


-----The following script prints the statistics for each collection in each database:-----


db._adminCommand("listDatabases").databases.forEach(function (d) {
   mdb = db.getSiblingDB(d.name);
   mdb.getCollectionNames().forEach(function(c) {
      s = mdb[c].stats();
      printjson(s);
   })
})
---------------------------------------------

Reading and Storing the Text from PDF - Using SQL Server 2017 & R





How to Read Text from PDF - Using SQL Server 2017 & R

Insert into tbl_PDF
EXECUTE sp_execute_external_script
@language = N'R',
@script = N' 

# load packages (Pdftools is the R package whicn needs to be downloaded and loaded)
library(pdftools)

# Read PDF
text <- pdf_text("C://suresh//mybook.pdf")

# Return Output
OutputDataSet = data.frame(text)',
@output_data_1_name=N'OutputDataSet'

select * from tbl_PDF