MongoDB's official C # drive AsQueryable has been pitfall,

Source: Internet
Author: User
Tags install mongodb mongodb driver

MongoDB's official C # drive AsQueryable has been pitfall,
Collection. AsQueryable (). Where () has four overload values:

public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate);public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate);public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate);public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate);
Because the number and list of queries need to be performed simultaneously on the page, the condition is proposed, and the result type is incorrectly selected as IEnumerable. Func Instead of IQueryable Expression >. The result is filtered and sorted in C. Alas, you will need to see the provider in the future using the extension method.
Statistics show that everyone uses the MongoDB driver

The one officially provided is quite useful.

Encapsulate the Context obtained by a connection and GenericDao for business expansion. Then, separate the encapsulated dll and reuse it later.

I have never heard of the one you mentioned, but for third-party drivers, you can consider using it if you have detailed instructions and technical team support.

How to install mongoDB as a system service

The command used is as follows:
Microsoft Windows XP [version 5.1.2600] (C) Copyright: 1985-2001 Microsoft Corp. c: \ Documents and Settings \ Administrator> mongod-dbpath C: \ mongo \ MongoDB \ mongo \ data -- logpath = C: \ mongo \ MongoDB \ mongo \ logs \ mongodb. log -- auth -- installall output going to: C: \ mongo \ MongoDB \ mongo \ logs \ mongodb. logC: \ Documents ents and Settings \ Administrator>
But cannot connect:
C: \ Documents ents and Settings \ Administrator> mongo MongoDB shell version: 2.0.1connecting to: testTue May 29 18:07:50 Error: couldn't connect to server 127.0.0.1 shell/mongo. js: 84 exception: connect failed
After reading the log, you also need to use the net start MongoDB command to start the service. The log is as follows:
Creating service MongoDB. service creation successful. service can be started from the command line via 'net start "MongoDB "'. tue May 29 18:06:43 dbexit: Tue May 29 18:06:43 shutdown: going to close listening sockets... tue May 29 18:06:43 shutdown: going to flush diaglog... tue May 29 18:06:43 shutdown: going to close sockets... tue May 29 18:06:43 shutdown: waiting for fs preallocator... tue May 29 18:06:43 shutdown: closing all files... tue May 29 18:06:43 closeAllFiles () finishedTue May 29 18:06:43 dbexit: really exiting now
Follow the prompts to run net start MongoDB in CMD
Net start "MongoDB" 'C: \ Documents and Settings \ Administrator> net start mongoDB System Error 2. The system cannot find the specified file.
Through the control panel-> Administrative Tools-> services, you can view the services you just installed:
Somehow, the path of the mongod command is changed to C: \ Documents and Settings \ Administrator \, as shown below:
"C: \ ...... the remaining full text>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.