private static bool Delete(BsonDocument bson, string collectionName)
 {
     if (bson.ElementCount == 0)
     {
         return(false);
     }
     return(MongodbMain.GetCollection(collectionName).DeleteMany(bson).DeletedCount > 0);
 }
        private static bool checkLink(string collectionName, string url)
        {
            var bson       = new BsonDocument();
            var collection = MongodbMain.GetCollection(collectionName);

            bson.Add("link", url);
            return(collection.CountDocuments(bson) > 0);
        }
        public static void InsertOne(BsonDocument bson, string collectionName)
        {
            if (bson == null || bson.ElementCount == 0)
            {
                return;
            }
            var collection = MongodbMain.GetCollection(collectionName);

            collection.InsertOne(bson);
        }
        public static void InsertMany(IEnumerable <BsonDocument> bsons, string collectionName)
        {
            var collection = MongodbMain.GetCollection(collectionName);

            collection.InsertMany(bsons);
        }