Skip to content

Instantly share code, notes, and snippets.

@kenwalger
kenwalger / Program.cs
Created Oct 23, 2019
C# and MongoDB Delete Operation
View Program.cs
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)
@kenwalger
kenwalger / Program.cs
Last active Jul 7, 2021
C# and MongoDB Update Operation
View Program.cs
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)
@kenwalger
kenwalger / Program.cs
Last active Dec 18, 2020
C# and MongoDB: Read Operation Quick Start
View Program.cs
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)
@kenwalger
kenwalger / app.py
Created Jun 12, 2018
PyMongo Sample for Advocacy Hub
View app.py
from pymongo import MongoClient
import datetime
client = MongoClient('localhost', 27017)
db = client['advocacy-hub-db']
collection = db['pyMongo']
@kenwalger
kenwalger / temp_sensor.py
Created Jun 13, 2017
MicroPython Temperature Sensor for the NodeMCU ESP8266.
View temp_sensor.py
from machine import ADC
adc = ADC(0) # assign to the analog to digital 0 pin
adc.read() # returns TMP 36 value
def temp(value):
return value/10
View mongodb_crud.py
import pprint
from pymongo import MongoClient
__author__ = 'Ken W. Alger'
HOST = 'localhost'
PORT = 27017
@kenwalger
kenwalger / MongoJava.java
Created Feb 2, 2016
MongoDB CRUD in Java
View MongoJava.java
import com.mongodb.ErrorCategory;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.MongoWriteException;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.bson.Document;