Skip to content

Commit

Permalink
made a demo so its a all in one drop in as of unity 2019.4.0f1
Browse files Browse the repository at this point in the history
thank you
  • Loading branch information
fenderrex committed May 17, 2021
1 parent ffea65e commit 099588a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Model_Upload.cs
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);
}
}


}
18 changes: 18 additions & 0 deletions Model_User.cs
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 ...
}

0 comments on commit 099588a

Please sign in to comment.