-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made a demo so its a all in one drop in as of unity 2019.4.0f1
thank you
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using MongoDB.Driver; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class Model_Upload : MonoBehaviour | ||
{ | ||
private const string MONGO_URI = "mongodb://127.0.0.1:27017"; | ||
private const string DATABASE_NAME = "testDatabase"; | ||
private MongoClient client; | ||
private IMongoDatabase db; | ||
|
||
void Start() | ||
{ | ||
client = new MongoClient(MONGO_URI); | ||
db = client.GetDatabase(DATABASE_NAME); | ||
IMongoCollection<Model_User> userCollection = db.GetCollection<Model_User>("collectionName"); | ||
Model_User e = new Model_User(); | ||
e.name = "hope"; | ||
userCollection.InsertOne(e); | ||
List<Model_User> userModelList = userCollection.Find(user => true).ToList(); | ||
Model_User[] userAsap= userModelList.ToArray(); | ||
foreach(Model_User asap in userAsap) | ||
{ | ||
print(asap.name); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using MongoDB.Driver; | ||
using MongoDB.Bson; | ||
// Model_User Sample | ||
public class Model_User | ||
{ | ||
public ObjectId _id { set; get; } | ||
public string name { set; get; } | ||
|
||
public int ActiveConnection { set; get; } | ||
public string Username { private set; get; } | ||
public string Email { private set; get; } | ||
public string ShaPassword { private set; get; } | ||
|
||
//Possible Methods ... | ||
} |