Skip to content

Instantly share code, notes, and snippets.

@prashanthmadi
Created January 17, 2019 22:20
Show Gist options
  • Save prashanthmadi/23f4caeb3703f9424e4db2886a74ab4b to your computer and use it in GitHub Desktop.
Save prashanthmadi/23f4caeb3703f9424e4db2886a74ab4b to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose')
const db = mongoose.connect('mongodb://mongo1234:Shrk6VZMbwCjEV0Fwmz2m3qHx3qhdQMAaLw52pKOrWCji2NhOOHEJVM6W51SKiDLv5a5pQRUybwABnGKRwDy4A==@mongo1234.documents.azure.com:10255/d1?ssl=true&replicaSet=globaldb',{useNewUrlParser: true});
var Schema = mongoose.Schema;
var schema = new Schema({ name: String },{ shardKey: { name: 1 }});
const Cat = mongoose.model('Cat',schema);
//Cat.create({name: 'Zildjian'});
const kitty = new Cat({ name: 'Zildjian' });
kitty.save().then(() => console.log('meow'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment