Skip to content

Instantly share code, notes, and snippets.

@kenwalger
kenwalger / MongoJava.java
Created February 2, 2016 06:33
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;
View mongodb_crud.py
import pprint
from pymongo import MongoClient
__author__ = 'Ken W. Alger'
HOST = 'localhost'
PORT = 27017
@kenwalger
kenwalger / temp_sensor.py
Created June 13, 2017 05:11
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
@kenwalger
kenwalger / app.py
Created June 12, 2018 23:24
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 / Program.cs
Last active December 18, 2020 16:34
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 / Program.cs
Last active January 6, 2023 13:09
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
Created October 23, 2019 14:28
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)