Search Results

Search found 1015 results on 41 pages for 'mongodb csharp'.

Page 15/41 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • encapsulation in python list (want to use " instead of ')

    - by Codehai
    I have a list of users users["pirates"] and they're stored in the format ['pirate1','pirate2']. If I hand the list over to a def and query for it in MongoDB, it returns data based on the first index (e.g. pirate1) only. If I hand over a list in the format ["pirate1","pirate"], it returns data based on all the elements in the list. So I think there's something wrong with the encapsulation of the elements in the list. My question: can I change the encapsulation from ' to " without replacing every ' on every element with a loop manually? Short Example: aList = list() # get pirate Stuff # users["pirates"] is a list returned by a former query # so e.g. users["pirates"][0] may be peter without any quotes for pirate in users["pirates"]: aList.append(pirate) aVar = pirateDef(aList) print(aVar) the definition: def pirateDef(inputList = list()): # prepare query col = mongoConnect().MYCOL # query for pirates Arrrr pirates = col.find({ "_id" : {"$in" : inputList}} ).sort("_id",1).limit(50) # loop over users userList = list() for person in pirates: # do stuff that has nothing to do with the problem # append user to userlist userList.append(person) return userList If the given list has ' encapsulation it returns: 'pirates': [{'pirate': 'Arrr', '_id': 'blabla'}] If capsulated with " it returns: 'pirates' : [{'_id': 'blabla', 'pirate' : 'Arrr'}, {'_id': 'blabla2', 'pirate' : 'cheers'}] EDIT: I tried figuring out, that the problem has to be in the MongoDB query. The list is handed over to the Def correctly, but after querying pirates only consists of 1 element... Thanks for helping me Codehai

    Read the article

  • checking mongo database for data

    - by user1647484
    I'm playing around with this tutorial that uses Sinatra, backbone.js, and mongodb for the database. It's my first time using mongo. As far as I understand it the app uses both local storage and a database. it has these routes for the database. For example, it has these routes get '/api/:thing' do DB.collection(params[:thing]).find.to_a.map{|t| from_bson_id(t)}.to_json end get '/api/:thing/:id' do from_bson_id(DB.collection(params[:thing]).find_one(to_bson_id(params[:id]))).to_json end post '/api/:thing' do oid = DB.collection(params[:thing]).insert(JSON.parse(request.body.read.to_s)) "{\"_id\": \"#{oid.to_s}\"}" end After turning the server off and then on, I could see in the server getting data from the database routes 127.0.0.1 - - [17/Sep/2012 08:21:58] "GET /api/todos HTTP/1.1" 200 430 0.0033 My question is, how can I check from within the mongo shell whether the data's in the database? I started the mongo shell ./bin/mongo I selected the database 'use mydb' and then looking at the docs (http://www.mongodb.org/display/DOCS/Tutorial) I tried commands such as > var cursor = db.things.find(); > while (cursor.hasNext()) printjson(cursor.next()); but they didn't return anything.

    Read the article

  • new project app; use entirely node.js

    - by Jared
    I have been looking into Node.js, express and Nowjs and love how easy it is to have real time interactions between clients. My background is mostly from CodeIgniter MVC using PHP and MYSql. I want to re make a current web project of mine from scratch to make everything better and more real time with this newer technology. After researching and doing test examples I want to use node.js , express and Nowjs for the real time interactions once someone connects to the socket.io to pull data back to clients. But use Code Igniter for the control of the site and user management , possible shopping cart/store , pretty much everything else. This is purely due to time constraints and that I am already familiar with doing it that way. I have been looking at MongoDB as an alternative to MySql, Basically the app is going to be multiple chat rooms all on one page. with the ability of notifications and private messaging. Lots of data transfer and images. before I started piecing it together I wanted to get people who have already done something similar. My model would use Code Igniter and MySQL to render the page and then connect them onto a node.js server and broadcast using express and nowjs would using a mongoDB be better than mySQL for tons of messages and data being stored or MYSQL? Also does it make since to not make the whole site on Node.js , kinda piece it together like that?

    Read the article

  • MongoMapper and migrations

    - by Clint Miller
    I'm building a Rails application using MongoDB as the back-end and MongoMapper as the ORM tool. Suppose in version 1, I define the following model: class SomeModel include MongoMapper::Document key :some_key, String end Later in version 2, I realize that I need a new required key on the model. So, in version 2, SomeModel now looks like this: class SomeModel include MongoMapper::Document key :some_key, String key :some_new_key, String, :required => true end How do I migrate all my existing data to include some_new_key? Assume that I know how to set a reasonable default value for all the existing documents. Taking this a step further, suppose that in version 3, I realize that I really don't need some_key at all. So, now the model looks like this class SomeModel include MongoMapper::Document key :some_new_key, String, :required => true end But all the existing records in my database have values set for some_key, and it's just wasting space at this point. How do I reclaim that space? With ActiveRecord, I would have just created migrations to add the initial values of some_new_key (in the version1 - version2 migration) and to delete the values for some_key (in the version2 - version3 migration). What's the appropriate way to do this with MongoDB/MongoMapper? It seems to me that some method of tracking which migrations have been run is still necessary. Does such a thing exist? EDITED: I think people are missing the point of my question. There are times where you want to be able to run a script on a database to change or restructure the data in it. I gave two examples above, one where a new required key was added and one where a key can be removed and space can be reclaimed. How do you manage running these scripts? ActiveRecord migrations give you an easy way to run these scripts and to determine what scripts have already been run and what scripts have not been run. I can obviously write a Mongo script that does any update on the database, but what I'm looking for is a framework like migrations that lets me track which upgrade scripts have already been run.

    Read the article

  • NoSQL DB for .Net document-based database (ECM)

    - by Dane
    I'm halfway through coding a basic multi-tenant SaaS ECM solution. Each client has it's own instance of the database / datastore, but the .Net app is single instance. The documents are pretty much read only (i.e. an image archive of tiffs or PDFs) I've used MSSQL so far, but then started thinking this might be viable in a NoSQL DB (e.g. MongoDB, CouchDB). The basic premise is that it stores documents, each with their own particular indexes. Each tenant can have multiple document types. e.g. One tenant might have an invoice type, which has Customer ID, Invoice Number and Invoice Date. Another tenant might have an application form, which has Member Number, Application Number, Member Name, and Application Date. So far I've used the old method which Sharepoint (used?) to use, and created a document table which has int_field_1, int_field_2, date_field_1, date_field_2, etc. Then, I've got a "mapping" table which stores the customer specific index name, and the database field that will map to. I've avoided the key-value pair model in the DB due to volume of documents. This way, we can support multiple document types in the one table, and get reasonably high performance out of it, and allow for custom document type searches (i.e. user selects a document type, then they're presented with a list of search fields). However, a NoSQL DB might make this a lot simpler, as I don't need to worry about denormalizing the document. However, I've just got concerns about the rest of the data around a document. We store an "action history" against the document. This tracks views, whether someone emails the document from within the system, and other "future" functionality (e.g. faxing). We have control over the document load process, so we can manipulate the data however it needs to be to get it in the document store (e.g. assign unique IDs). Users will not be adding in their own documents, so we shouldn't need to worry about ACID compliance, as the documents are relatively static. So, my questions I guess : Is a NoSQL DB a good fit Is MongoDB the best for Asp.Net (I saw Raven and Velocity, but they're still kinda beta) Can I store a key for each document, and then store the action history in a MSSQL DB with this key? I don't need to do joins, it would be if a person clicks "View History" against a document. How would performance compare between the two (NoSQL DB vs denormalized "document" table) Volumes would be up to 200,000 new documents per month for a single tenant. My current scaling plan with the SQL DB involves moving the SQL DB into a cluster when certain thresholds are reached, and then reviewing partitioning and indexing structures.

    Read the article

  • Use cases for NoSQL

    - by seengee
    NoSQL has been getting a lot of attention in the industry recently. Really interested in peoples thoughts on the best use-cases for its use over relational database storage. What should trigger a developer into thinking that particular datasets are more suited to a NoSQL solution like Redis/CouchDB/MongoDB/Cassandra etc. Would also be really interested to hear what people have ported from relational db's to NoSQL and what improvements they have seen.

    Read the article

  • Clojure and NoSQL databases

    - by Mad Wombat
    I am currently trying to pick between different NoSQL databases for my project. The project is being written in clojure and javascript. I am currently looking at three candidates for storage. What are the relative strengths and weaknesses of MongoDB, FleetDB and CouchDB? Which one is better supported in Clojure? Which one is better supported under Linux? Did I miss a better product (has to be free and OSS)?

    Read the article

  • TG2.1: Proper location to store a database session instance?

    - by Lee Olayvar
    I am using a custom database (MongoDB) with TG 2.1 and i am wondering where the proper place to store the PyMongo connection/database instances would be? Eg, at the moment they are getting created inside of my inherited instance of AppConfig. Is there a standard location to store this? Would shoving the variables into the project.model.__init__ be the best location, given that under SQLAlchemy, the database seems to commonly be retrieved via: from project.model import DBSession, metadata Anyway, just curious what the best practice is.

    Read the article

  • Exception in morphia-0.93-SNAPSHOT.jar

    - by Rupeshit
    Hi guys, I am trying to mapp pojo class to mongodb using morphia-0.93-SNAPSHOT.jar but it is throwing exception that "java.lang.NoClassDefFoundError: org/bson/types/CodeWScope" which is bson's exception.So I am not able to run those programs.So please can anybody help me to solved this problem

    Read the article

  • Grails Domain.get() returns null for mongo's ObjectId

    - by Shashank Agrawal
    I'm using grails 2.3.5 with mongodb 3.0.1 and no hibernate installed. I've a domain class which uses mongo's ObjectId. import org.bson.types.ObjectId class Category { ObjectId id String name } And has a record in mongo database: { "_id": ObjectId("53f6c34c33a429240e2ab471"), "name": "art", "version": NumberLong("41") } When I do, Category.get(new ObjectId("53f6c34c33a429240e2ab471")) somewhere in grails app, it returns null but when I do Category.get("53f6c34c33a429240e2ab471") it then actually returns the result. Why, get() method does not process ObjectId type?

    Read the article

  • Directory Hierarchy

    - by niveditha
    How to build a folder structure using morphia or the mongodb API? I am looking for something like this. folderA --->folderB --->folderC ------>fileC ------>folderCA ---------->fileCA

    Read the article

  • Initializing a property in c#

    - by Shonna
    I have a constructor I am trying to build with the header public KsuPoint(double x0, double y0) now i also have properties in the class as shown below private double x; public double X { get { return x; } } private double y; public double Y { get { return y; } } This constructor is suppose to initialize the properties X and Y ... is this correct? or am i off? public KsuPoint(double x0, double y0) { new KsuPoint(x0, y0); }

    Read the article

  • How to get actual type of an derived class from its parent interface

    - by Tarik
    Hello people, Lets say we have a code portion like this : IProduct product = ProductCreator.CreateProduct(); //Factory Method we have here SellThisProduct(product); //... private void SellThisProduct(IProduct product) { //..do something here } //... internal class Soda : IProduct {} internal class Book : IProduct {} How can I infer which product is actually passed into SellThisProduct() method in the method? I think if I say GetType() or something it will probably return the IProduct type. Thanks...

    Read the article

  • Which audio library to use?

    - by Jeb
    I want to build a .Net application for processing audio, and distribute it using ClickOnce deployment. I need access to a raw audio pipeline. Which audio library should I be using? I've heard the managed libraries for DirectSound are a dead end. I need as little as possible to be installed on the client's machine. Anything outside of the ClickOnce process isn't going to work. NAudio might be a possibility, but isn't there potentially a separate driver install? There's also SlimDX. It's a shame -- the managed DirectX libraries seem to work nicely and from what I've read, DirectX can be included in the ClickOnce install.

    Read the article

  • Correct method to search for AD user by email address from .NET

    - by BrianLy
    I'm having some issues with code that is intended to find a user in Active Directory by searching on their email address. I have tried 2 methods but I'm sometimes finding that the FindOne() method will not return any results on some occasions. If I look up the user in the GAL in Outlook I see the SMTP email address listed. My end goal is to confirm that the user exists in AD. I only have the email address as search criteria, so no way to use first or last name. Method 1: Using mail property: DirectorySearcher search = new DirectorySearcher(entry); search.Filter = "(mail=" + email + ")"; search.PropertiesToLoad.Add("mail"); SearchResult result = search.FindOne(); Method 2: proxyAddresses property: DirectorySearcher search = new DirectorySearcher(entry); search.Filter = "(proxyAddresses=SMTP:" + email + ")"; // I've also tried with =smtp: search.PropertiesToLoad.Add("mail"); SearchResult result = search.FindOne(); I've tried changing the case of the email address input but it still does not return a result. Is there a problem here with case sensitivity? If so, what is the best way to resolve it?

    Read the article

  • Creating XSD Dynamically in C Sharp

    - by Nave
    I have two inputs. I get as input one XML file. I have to create an XSD file for this XML file. This XML file has tags which depend on another input. But that XML file should have certain tags for sure. For example, the XML file has the following structure : <A <B <C...</C <D...</D <E <F...</F <G...</G </E </B </A Here, in this XML file, A,B and E tags should be present compulsarily. But the tags C and D inside the B tag and tags F and G inside the E tag depends on another input. So I shoud create an XSD dynamically(i know that A,B and E tags should be present and I do know about the other tags from the other input) and validate the input XML file against the XML Schema. Can someone temme how I can do this in C Sharp?

    Read the article

  • Creating XSD Dynamically in C Sharp

    - by Nave
    I have two inputs. I get as input one XML file. I have to create an XSD file for this XML file. This XML file has tags which depend on another input. But that XML file should have certain tags for sure. For example, the XML file has the following structure : <A <B <C...</C <D...</D <E <F...</F <G...</G </E </B </A Here, in this XML file, A,B and E tags should be present compulsarily. But the tags C and D inside the B tag and tags F and G inside the E tag depends on another input. So I shoud create an XSD dynamically(i know that A,B and E tags should be present and I do know about the other tags from the other input) and validate the input XML file against the XML Schema. Can someone temme how I can do this in C Sharp?

    Read the article

  • c# - SQL - speed up code to DB

    - by user228058
    I have a page with 26 sections - one for each letter of the alphabet. I'm retrieving a list of manufacturers from the database, and for each one, creating a link - using a different field in the Database. So currently, I leave the connection open, then do a new SELECT by each letter, WHERE the Name LIKE that letter. It's very slow, though. What's a better way to do this? TIA

    Read the article

  • C# Constructor & List Question

    - by ShonnaE
    Ohk, I am doing a c-sharp program, and I get everything but this, I just can't understand what it is asking. I know how to create a list.. and how to create a constructor.. but this is where i get confused.. its probably way simple but i am missing it. I created 2 lists .. now i should create a constructor here is one my lists List<Person> organize = new List<Person>(); THIS PART --- *The constructor should also initialize the two event lists to new empty lists. *

    Read the article

  • ASP Dot Net : How to repeat HTML parts with minor differences on a page?

    - by tinky05
    It's a really simple problem. I've got HTML code like this : <div> <img src="image1.jpg" alt="test1" /> </div> <div> <img src="image2.jpg" alt="test2" /> </div> <div> <img src="image3.jpg" alt="test3" /> </div> etc... The data is comming from a DB (image name, alt text). In JAVA, I would do something like : save the info in array in the back end. For the presentation I would loop through it with JSTL : <c:foeach items="${data}" var="${item}> <div> <img src="${item.image}" alt="${item.alt}" /> </div> </c:foreach> What's the best practice in ASP.net I just don't want to create a string with HTML code in it in the "code behind", it's ugly IMO.

    Read the article

  • How to fill byte array with junk? C#

    - by flyout
    I am using this: byte[] buffer = new byte[10240]; As I understand this initialize the buffer array of 10kb filled with 0s. Whats the fastest way to fill this array (or initialize it) with junk data everytime? I need to use that array like 5000 times and fill it everytime with different junk data, thats why I am looking for a fast method to do it. The array size will also have to change everytime.

    Read the article

  • Attached property and style missing on re adding the user control

    - by RodD
    Hey people I've got an issue with a WPF project I'm working on, I have an items control which I add to and remove from certain user controls, these contols styles and attached properties are there on first view but when I remove and add them again the user control apears on screen but is detached from the items control attached properties and styles. Is this behaviour common and if so what is the best way to handle it? Thanks in advance

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >